Hi Igor,

I changed the implemention of wicket-stuff-phonebook to suit my needs where
in i needed do disable the delete button if none selected and re-enable it.
I also successfully used AjaxCheckBox and updated the webmarkup container
containing buttons.
Now, in the same example app. 
1. I am trying to add the checkgroupselector to select all the checkboxes 
and I did the following.

HTML looks like this:
<form wicket:id="filter-form">
        <input type="hidden" name="tracker" wicket:id="focus-tracker"/>
        
        <divwicket:id="group">
        <input type="checkbox" wicket:id="groupselector">check/uncheck 
all</input>
        <table wicket:id="users" cellspacing="0" cellpadding="2" 
class="grid">[for
DataTable]</table>
        </div>
                
        <div wicket:id="focus-restore">[call to focus restore script]</div>

        
            <div wicket:id="buttonContainer">
        <input wicket:id="delete-selected" value="DELETE CHECKED CONTACTS"
type="submit"/>
        </div>
            
</form>

and the relavent Java Code looks like this:

            CheckGroup group=new CheckGroup("group");
            form.add(group);
            group.add(new CheckGroupSelector("groupselector"));

                // create the data table
                IColumn[] columns = createColumns(buttonContainer);
                users = new DefaultDataTable("users", Arrays.asList(columns),
dataProvider, 10);
                //users.addTopToolbar(new FilterToolbar(users, form, 
dataProvider));
                group.add(users);
Problem :

1. It does show checkgroup but checking/un-checking it does not affect the
check boxes under it. What am I doing wrong here?

2. Also, can you give a brief example of the navigator with submit links. 

Thanks,
Rachit


igor.vaynberg wrote:
> 
> On Tue, Jul 22, 2008 at 9:54 AM, nanotech <[EMAIL PROTECTED]> wrote:
>>
>> 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?
> 
> the navigator currently uses regular links. to preserve the selection
> you have to change the links to submitlinks. there are factories on
> the navigator that let you do that.
> 
>> 2. Can I  replace CheckBox with AjaxCheckBox and DataTable with
>> AjaxFallBackDataTable ?
> 
> yes
> 
> -igor
> 
>>
>> 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]
>>
>>
> 
> ---------------------------------------------------------------------
> 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-tp18581940p18595526.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]

Reply via email to