Hi ListView/Refreshing View any willd o

but dont know how to solve this.

Thanks
P

prati wrote:
> 
> Hi Team,
> 
> Also i dont want to remove values , i want to remove the entire row.
> My row contains(TextBox and option group)
> 
> 
> Thanks
> Prati
> 
> 
> prati wrote:
>> 
>> Hi
>> 
>> I have got a refreshingView with a delete link in each row and only one
>> AddLink,AddLink adds the 
>> 
>> row properly but deleteRow everytime deletes the last row,its driving me
>> crazy,I have posted my 
>> 
>> code also.I will apprecaite if any one can help me in this.
>> 
>> Honestly its not that easy the way it seams.
>> 
>> 
>> Thanks
>> 
>> Prati 
>> 
>> 
>> 
>> prati wrote:
>>> 
>>> Hi,
>>> 
>>> I am also having similar issue, it all the time removes last row.
>>> I have attached code.
>>> 
>>> 
>>> OptionGroupPageForm(String id) {
>>> 
>>>                     super(id);
>>> 
>>>                     final MarkupContainer rowPanel = new 
>>> WebMarkupContainer("rowPanel");
>>>                     rowPanel.setOutputMarkupId(true);
>>>                     add(rowPanel);
>>> 
>>>                     // List all rows
>>> 
>>> 
>>>                     rows.add(new String());
>>> 
>>>                     RefreshingView lv = new RefreshingView("rows") {
>>> 
>>>                             @Override
>>>                             protected Iterator<IModel> getItemModels()
>>>                             {
>>>                                     List models = new ArrayList();
>>> 
>>>                                     for(int i=0;i<rows.size();i++){
>>>                                             models.add(new Model( (String) 
>>> rows.get(i)));
>>>                                     }
>>> 
>>>                                     return models.iterator(); 
>>>                                     //return rows.iterator();
>>>                             }
>>> 
>>>                             @Override
>>>                             protected void populateItem(final Item item) {
>>> 
>>>                                     int index = item.getIndex() + 1;
>>> 
>>>                                     item.add(new Label("index", 
>>> "Option"+index + "."));
>>> 
>>>                                     TextField text = new TextField("text", 
>>> item.getModel());
>>> 
>>>                                     RadioChoice rc = new 
>>> RadioChoice("status", STATUS);
>>> 
>>>                                     item.add(text);
>>> 
>>>                                     item.add(rc);
>>> 
>>>                                     item.add(new AjaxLink("removeRow") {
>>> 
>>>                                             @Override
>>>                                             public void 
>>> onClick(AjaxRequestTarget target) {
>>> 
>>> 
>>>                                                     
>>> 
>>>                                                     if (target != null) {
>>>                                                             
>>> target.addComponent(rowPanel);
>>>                                                     }
>>>                                             }
>>>                                     } );
>>>                             }
>>>                     };
>>> 
>>>                     
>>> lv.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
>>>                     rowPanel.add(lv);
>>> 
>>>                     AjaxSubmitLink addLink = new AjaxSubmitLink("addRow", 
>>> this) {
>>>                             @Override
>>>                             public void onSubmit(AjaxRequestTarget target, 
>>> Form form) {
>>> 
>>>                                     rows.add(new String());
>>> 
>>> 
>>> 
>>>                                     if (target != null)
>>>                                             target.addComponent(rowPanel);
>>>                             }
>>>                     };
>>> 
>>>                     addLink.setDefaultFormProcessing(false);
>>> 
>>>                     add(addLink);
>>> 
>>> 
>>> 
>>> 
>>>             }
>>> 
>>> Thanks
>>> 
>>>  Prati
>>> 
>>> Johan Compagner wrote:
>>>> 
>>>> You do use a delete button, so i guess the values are submitted.
>>>> Then if you store those first in the model objects you won't loose
>>>> anything
>>>> 
>>>> johan
>>>> 
>>>> 
>>>> 
>>>> On Feb 4, 2008 2:35 PM, pnerkar <pner...@gmail.com> wrote:
>>>> 
>>>>>
>>>>> Hi Johan,
>>>>>
>>>>> Yes that will be quickest solution ,
>>>>> But this will clear the fields of all vehicles.
>>>>>
>>>>> -Pnerkar
>>>>>
>>>>>
>>>>> Johan Compagner wrote:
>>>>> >
>>>>> > wasn't the quickest solution:
>>>>> >
>>>>> > public void onSubmit() {
>>>>> >        List vehicles = (List)
>>>>> getParent().getParent().getModelObject();
>>>>> >        vehicles.remove(index);
>>>>> >        listView.removeAll();
>>>>> > }
>>>>> >
>>>>> > Then if the list itself is stable on the server side (if other
>>>>> persons
>>>>> can
>>>>> > also delete or add stuff to that list you really should do it
>>>>> differently)
>>>>> > that should work fine. After you alter the listviews model you have
>>>>> to
>>>>> > remove all the items so that it will rebuild
>>>>> >
>>>>> > johan
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > On Feb 1, 2008 12:49 AM, pnerkar <pner...@gmail.com> wrote:
>>>>> >
>>>>> >>
>>>>> >> Hi All,
>>>>> >>
>>>>> >> I have rendered a list view on a Web Page.
>>>>> >>
>>>>> >> vehicle1    X
>>>>> >> vehicle2    X
>>>>> >> vehicle3    X
>>>>> >>
>>>>> >> when a person click on 'X', that item should be deleted.
>>>>> >> But I'm facing an issue, when i click on 'X', last item get
>>>>> deleted.
>>>>> >> Actually when I delete vehicle2 from my list, it deletes vehicle2
>>>>> but
>>>>> >> that
>>>>> >> component is still there.
>>>>> >> So while rendering it render vehicle1 & vehicle2.
>>>>> >>
>>>>> >> public void onSubmit() {
>>>>> >>        List vehicles = (List)
>>>>> getParent().getParent().getModelObject();
>>>>> >>        vehicles.remove(index);
>>>>> >> }
>>>>> >>
>>>>> >> can please help out ??
>>>>> >>
>>>>> >>
>>>>> >>
>>>>> >> --
>>>>> >> View this message in context:
>>>>> >>
>>>>> http://www.nabble.com/How-to-delete-an-item-from-List-view.-tp15217608p15217608.html
>>>>> >> Sent from the Wicket - User mailing list archive at
>>>>> >> Nabble.com <http://nabble.com/><http://nabble.com/>
>>>>> >> .
>>>>> >>
>>>>> >>
>>>>> >>
>>>>> ---------------------------------------------------------------------
>>>>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> >> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>> >>
>>>>> >>
>>>>> >
>>>>> >
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-delete-an-item-from-List-view.-tp15217608p15268198.html
>>>>>  Sent from the Wicket - User mailing list archive at
>>>>> Nabble.com<http://nabble.com/>
>>>>> .
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>
>>>>>
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-delete-an-item-from-List-view.-tp15217608p27933095.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to