Hi Igor,
Thanks for the reply. I had a look at the phonebook example application in
wicket-stuff.
I have a question?
1. Currently it does not maintain the checked(or selected) items if you
change the datatable's pages. How can I add that feature?
2. Can I replace CheckBox with AjaxCheckBox and DataTable with
AjaxFallBackDataTable ?
Thanks,
Rachit
igor.vaynberg wrote:
>
> there is a checkgroup inside datatable example in wicket-stuff phonebook
>
> -igor
>
> On Tue, Jul 22, 2008 at 3:37 AM, nanotech <[EMAIL PROTECTED]> wrote:
>>
>> Hi All,
>>
>> Looking for some pointers. Anyone?
>>
>>
>> nanotech wrote:
>>>
>>> Hi,
>>>
>>> I am trying to add a column of checkboxes in data table with CheckGroup
>>> Selector.
>>> Html looks like this
>>> <wicket:panel>
>>> <form wicket:id="form">
>>>
>>> <input type="checkbox"
>>> wicket:id="groupselector">check/uncheck
>>> all</input>
>>> <table border="1" wicket:id="entries">[Data Table will
>>> be added
>>> here!!]</table>
>>>
>>> <wicket:fragment wicket:id="checkBoxFrag">
>>> <input type="checkbox" wicket:id="selected"/>
>>> </wicket:fragment>
>>> </form>
>>> </wicket:panel>
>>>
>>>
>>> The Column is added like this
>>> IColumn[] columns = {
>>> new AbstractColumn(new Model("Select - All")){
>>> public void populateItem(Item cellItem, String
>>> componentId,
>>> IModel rowModel) {
>>> PhoneBookEntry entry =
>>> (PhoneBookEntry)rowModel.getObject();
>>> cellItem.add(new
>>> PhoneBookEntrySelectionFragment(componentId,
>>> "checkBoxFrag",
>>> PhoneBookPanel.this,
>>> entry));
>>> }
>>>
>>> },
>>> new PropertyColumn(new Model("ID"), "id"),
>>> new PropertyColumn(new Model("First Name"), "firstName"),
>>> new PropertyColumn(new Model("Last Name"), "lName",
>>> "lastName"),
>>> new PropertyColumn(new Model("Tel No"), "telNum", "telNo")
>>> };
>>>
>>>
>>> DefaultDataTable dataTable = new DefaultDataTable("entries",
>>> columns,
>>> provider, 4);
>>>
>>> Form form = new Form("form");
>>> MyCheckGroup group = new MyCheckGroup("checkGroup",new
>>> ArrayList());
>>>
>>> group.add(new CheckGroupSelector("groupselector"));
>>>
>>> group.add(dataTable);
>>>
>>> form.add(group);
>>> add(form);
>>>
>>>
>>> The Fragment which generates the Check boxes on each row look like this
>>> public class PhoneBookEntrySelectionFragment extends Fragment {
>>>
>>> public PhoneBookEntrySelectionFragment(String id,
>>> String markupId,
>>> MarkupContainer
>>> markupProvider,
>>> PhoneBookEntry entry) {
>>> super(id, markupId, markupProvider);
>>> add(new Check("selected", new
>>> CheckBoxModel(entry.getId())) {
>>> protected boolean
>>> wantOnSelectionChangedNotifications() {
>>> return true;
>>> }
>>> });
>>> }
>>> }
>>>
>>>
>>> The Problem is:
>>> 1. If I click on any checkbox on any row all the checkboxes get selected
>>> at once. I noiced that the wicked id if all the checkboxes is the same
>>> which in this case is "selected" . What am I doing wrong here?
>>>
>>> 2. Also if I replace the follwing line
>>> DefaultDataTable dataTable = new DefaultDataTable("entries",
>>> columns,
>>> provider, 4);
>>>
>>> with
>>>
>>> AjaxFallBackDefaultDataTable dataTable = new
>>> AjaxFallBackDefaultDataTable
>>> ("entries", columns,
>>> provider, 4);
>>>
>>> then the navigation links stop working? Can anyone point out why?
>>>
>>> 3. Also, I want to be able to disable a button if more than one checkbox
>>> is selected. How can I do that?
>>>
>>> Thanks,
>>> Rachit
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/DataTable-%2B-CheckGroup-with-CheckGroupSelector-tp18581940p18586553.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/DataTable-%2B-CheckGroup-with-CheckGroupSelector-tp18581940p18593827.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]