Re: DefaultDataTable and AjaxEditableLabel
Philipp Daumke schrieb: I try to create an editable column using DefaultDataTable and AjaxEditableLabel. My current version is posted below but it's quite a hack and I wonder whether there's an official good solution for that before I go on with my work. i think the passing of your models is a little weird. anyhow, you might want to take a look at this example: http://wicketstuff.org/wicket13/nested/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.ajax.builtin.tree.EditableTreeTablePage cu uwe -- THOMAS DAILY GmbH Adlerstraße 19 79098 Freiburg Deutschland T + 49 761 3 85 59 0 F + 49 761 3 85 59 550 E schae...@thomas-daily.de www.thomas-daily.de Geschäftsführer/Managing Directors: Wendy Thomas, Susanne Larbig Handelsregister Freiburg i.Br., HRB 3947 Registrieren Sie sich unter http://morningnews.thomas-daily.de für die kostenfreien TD Morning News, eine Auswahl aktueller Themen des Tages morgens um 9:00 in Ihrer Mailbox. Hinweis: Der Redaktionsschluss für unsere TD Morning News ist täglich um 8:30 Uhr. Es werden vorrangig Informationen berücksichtigt, die nach 16:00 Uhr des Vortages eingegangen sind. Die Email-Adresse unserer Redaktion lautet redakt...@thomas-daily.de. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DefaultDataTable and AjaxEditableLabel
Hi Uwe, thanks for the link. I agree that my model passing is weird. Your link to the example explains an editable TreeTable but I look for a DataTable example. In that tree table example I cannot use the tree.table.PropertyEditableColumn as as the DefaultDataTable I want to use requires data.table.IColumns (not tree.table.IColumns) , or am I wrong? Or can I just cast them? Another ideas? Not to be mentioned I'm a wicket newbie and there's maybe a very simple solution for that Thanks, Philipp Philipp Daumke schrieb: I try to create an editable column using DefaultDataTable and AjaxEditableLabel. My current version is posted below but it's quite a hack and I wonder whether there's an official good solution for that before I go on with my work. i think the passing of your models is a little weird. anyhow, you might want to take a look at this example: http://wicketstuff.org/wicket13/nested/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.ajax.builtin.tree.EditableTreeTablePage cu uwe -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DefaultDataTable and AjaxEditableLabel
columns.add(new AbstractColumn(new Model(ColumnName)) { public void populateItem(Item cellItem, String componentId, final IModel model) { cellItem.add(new AjaxEditableLabel(componentId, new PropertyModel(model, 'attribute1')); } -igor On Thu, Jan 22, 2009 at 4:59 AM, Philipp Daumke dau...@averbis.de wrote: Dear all, I try to create an editable column using DefaultDataTable and AjaxEditableLabel. My current version is posted below but it's quite a hack and I wonder whether there's an official good solution for that before I go on with my work. Thanks al lot for your help Philipp HTML:table class=tablename cellspacing=0 wicket:id=termTable[table]/table Java: columns = new ArrayListIColumn(); columns.add(new AbstractColumn(new Model(ColumnName)) { public void populateItem(Item cellItem, String componentId, final IModel model) { cellItem.setModel(model); ObjectToDisplay to = (ObjectToDisplay )cellItem.getModelObject(); String attribute1= to.getAttribute1(); cellItem.add(new AjaxEditableLabel(componentId, new Model(attribute1)) { @Override protected void onSubmit(AjaxRequestTarget target) { super.onSubmit(target); String newAttribute1 = (String) getModelObject(); ObjectToDisplay obj = (ObjectToDisplay ) getParent().getModelObject(); obj.setAttribute1(newAttribute1); System.out.println(New Attribute for + obj .getId() + : + obj .getAttribute1(); } }); } add(new DefaultDataTable(tablename, columns, provider, 20)); SortableDataProvider provider = new SortableDataProvider() { public int size() { return resultList.getEntries().size(); } public IModel model(Object object) { TableObject entry = (TableObject) object; return new Model((Serializable) entry); } /*public Iterator iterator(int first, int count) { return resultList.selectEntries(first, count).iterator(); }*/ public Iterator iterator(int first, int count) { SortParam sp = getSort(); return resultList.selectEntries(first, count, sp).iterator(); } }; -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org