Editable DefaultDataTable
Hello Currently I am working on Editable DefaultDatatable. My first attempt was to override protected ItemT newRowItem with final Item item = super.newRowItem(id, index, tiModel); item.add(new AjaxFormSubmitBehavior(onclick) { naively thought that adding rowItem to ajax target will trigger ICellPopulator#populateItem call for every cell so I have a chance to read special metaData from parent rowItem and if it exists return TextField instead Label for every cell iin a row.. It seems I was wrong - item repopulation does not happens. I need any advice how may I implement such behaviour, except switching to Knopp's code. It just impossible right now becouse there are already implemented filter functionality. Thank's in advance. P.S.: I hope I am not alone who works now and does not shopping. -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
Implementing what? The one reason why we cant move to Knopp's implementation is huge relaying on IColumn and all that things. So, we already have enough IColumn implementation. What exactly you suggest to overload? On 26 December 2010 20:09, Jeremy Thomerson jer...@wickettraining.com wrote: You might have better success implementing it in your IColumn implementations since they generate the components for each cell. On Sun, Dec 26, 2010 at 4:55 AM, alex shubert alex.shub...@gmail.com wrote: Hello Currently I am working on Editable DefaultDatatable. My first attempt was to override protected ItemT newRowItem with final Item item = super.newRowItem(id, index, tiModel); item.add(new AjaxFormSubmitBehavior(onclick) { naively thought that adding rowItem to ajax target will trigger ICellPopulator#populateItem call for every cell so I have a chance to read special metaData from parent rowItem and if it exists return TextField instead Label for every cell iin a row.. It seems I was wrong - item repopulation does not happens. I need any advice how may I implement such behaviour, except switching to Knopp's code. It just impossible right now becouse there are already implemented filter functionality. Thank's in advance. P.S.: I hope I am not alone who works now and does not shopping. -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
Well, in the IColumn is where it actually creates a label to display something in the table. If you want to have it editable, that's where you need the if (foo) { rowItem.add(new Label(...)); } else { rowItem.add(new TextField(...)) } logic. On Sun, Dec 26, 2010 at 11:58 AM, Alex Shubert alex.shub...@gmail.com wrote: Implementing what? The one reason why we cant move to Knopp's implementation is huge relaying on IColumn and all that things. So, we already have enough IColumn implementation. What exactly you suggest to overload? On 26 December 2010 20:09, Jeremy Thomerson jer...@wickettraining.com wrote: You might have better success implementing it in your IColumn implementations since they generate the components for each cell. On Sun, Dec 26, 2010 at 4:55 AM, alex shubert alex.shub...@gmail.com wrote: Hello Currently I am working on Editable DefaultDatatable. My first attempt was to override protected ItemT newRowItem with final Item item = super.newRowItem(id, index, tiModel); item.add(new AjaxFormSubmitBehavior(onclick) { naively thought that adding rowItem to ajax target will trigger ICellPopulator#populateItem call for every cell so I have a chance to read special metaData from parent rowItem and if it exists return TextField instead Label for every cell iin a row.. It seems I was wrong - item repopulation does not happens. I need any advice how may I implement such behaviour, except switching to Knopp's code. It just impossible right now becouse there are already implemented filter functionality. Thank's in advance. P.S.: I hope I am not alone who works now and does not shopping. -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
Ummm interface IColumn extends ICellPopulator and there are no place to insert that code. It is possible in ICellPopulator and, as I said before, the #populateItem is called only once so you just cant read the state from row. I'll try to explain: what I need is to trigger row cells repopulation on user click on any cell in that row. so, it may be described as: cell clicked - row announced- every cell in that row repaint/replaces it's content On 26 December 2010 21:16, Jeremy Thomerson jer...@wickettraining.com wrote: Well, in the IColumn is where it actually creates a label to display something in the table. If you want to have it editable, that's where you need the if (foo) { rowItem.add(new Label(...)); } else { rowItem.add(new TextField(...)) } logic. On Sun, Dec 26, 2010 at 11:58 AM, Alex Shubert alex.shub...@gmail.com wrote: Implementing what? The one reason why we cant move to Knopp's implementation is huge relaying on IColumn and all that things. So, we already have enough IColumn implementation. What exactly you suggest to overload? On 26 December 2010 20:09, Jeremy Thomerson jer...@wickettraining.com wrote: You might have better success implementing it in your IColumn implementations since they generate the components for each cell. On Sun, Dec 26, 2010 at 4:55 AM, alex shubert alex.shub...@gmail.com wrote: Hello Currently I am working on Editable DefaultDatatable. My first attempt was to override protected ItemT newRowItem with final Item item = super.newRowItem(id, index, tiModel); item.add(new AjaxFormSubmitBehavior(onclick) { naively thought that adding rowItem to ajax target will trigger ICellPopulator#populateItem call for every cell so I have a chance to read special metaData from parent rowItem and if it exists return TextField instead Label for every cell iin a row.. It seems I was wrong - item repopulation does not happens. I need any advice how may I implement such behaviour, except switching to Knopp's code. It just impossible right now becouse there are already implemented filter functionality. Thank's in advance. P.S.: I hope I am not alone who works now and does not shopping. -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
On Sun, Dec 26, 2010 at 12:25 PM, Alex Shubert alex.shub...@gmail.com wrote: Ummm interface IColumn extends ICellPopulator and there are no place to insert that code. It is possible in ICellPopulator and, as I said before, the #populateItem is called only once so you just cant read the state from row. populateItem is called to create the component hierarchy for your table every time it needs to be recreated. If you put a break point in populateItem and it is not getting called after you have clicked a stateful link on the page, check the item reuse strategy. That determines whether the table holds on to its component hierarchy or not after the page is rendered. If it does not (which should be the default), then your populateItem will get called for *every cell* in that column, for *every row*, on *every render* (including after a link is clicked). -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
Sure. But it doesnt look like a solution for it's resource consumption. So, again: after any cell click I need to announce the rw and the row must, in turn, somehow command only it's cells to repopulate their content. I know, how to do it without any framework, but wicket way to do it unclear for me. populateItem is called to create the component hierarchy for your table every time it needs to be recreated. If you put a break point -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
On Sun, Dec 26, 2010 at 12:47 PM, Alex Shubert alex.shub...@gmail.com wrote: Sure. But it doesnt look like a solution for it's resource consumption. On this list, we prefer solid facts based on proven theories rather than uh, I think it will use too many resources. If you're using a pagable table, you're probably not rendering hundreds [or thousands] of rows per render. Maybe 50, tops. Recreating the component hierarchy will take the computer less time (which is what I assume you really mean by resources) than just about anything else that you are likely to do in your code. The alternative is to add the edit and non-edit components to the hierarchy initially. In them, override isVisible (or, onConfigure and use setVisible) and toggle their visibility based on whether that row is in edit mode. Then, your link simply needs to store a variable that says which row is in edit mode. Perhaps an integer with the row index. Whatever. The problem with the second strategy is that you now have to have either a panel or a fragment for each column because you are putting two components into the cell, and the markup only has a placeholder for one. So, again: after any cell click I need to announce the rw and the row must, in turn, somehow command only it's cells to repopulate their content. I know, how to do it without any framework, but wicket way to do it unclear for me. I understood what you wanted to do. You were wanting to do it the old way. The way you were accustomed to. Because you thought you needed to do it that way. I was trying to tell you how to do it in Wicket. :) -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
On Sun, Dec 26, 2010 at 12:58 PM, Jeremy Thomerson jer...@wickettraining.com wrote: On Sun, Dec 26, 2010 at 12:47 PM, Alex Shubert alex.shub...@gmail.com wrote: Sure. But it doesnt look like a solution for it's resource consumption. On this list, we prefer solid facts based on proven theories rather than uh, I think it will use too many resources. If you're using a pagable table, you're probably not rendering hundreds [or thousands] of rows per render. Maybe 50, tops. Recreating the component hierarchy will take the computer less time (which is what I assume you really mean by resources) than just about anything else that you are likely to do in your code. The alternative is to add the edit and non-edit components to the hierarchy initially. In them, override isVisible (or, onConfigure and use setVisible) and toggle their visibility based on whether that row is in edit mode. Then, your link simply needs to store a variable that says which row is in edit mode. Perhaps an integer with the row index. Whatever. The problem with the second strategy is that you now have to have either a panel or a fragment for each column because you are putting two components into the cell, and the markup only has a placeholder for one. One other alternative would involve manually doing the repopulate yourself. Presumably your link is in one of the columns in the row. At that point, it has a reference to the table and the row item. It could iterate through the columns of the table and call populateItem manually for that particular row. -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
Jeremy thanks for your patience. that last thing is what I meaning. But how to make row call repopulate on it's column. I mean, it is not a problem to visit every child of rowItem and filter all of IColumn descendants. But there are no reason to call populateItem on IColumn as I have no idea what to do with received Components. Is it correct that you this approach suggest to re-implement all class from AbstractDataGridView? Or do I miss something? P.S. : it is strange a bit, but I did not set reusable strategy... and still no #populateItem calls. I have to look in the sources, I guess. One other alternative would involve manually doing the repopulate yourself. Presumably your link is in one of the columns in the row. At that point, it has a reference to the table and the row item. It could iterate through the columns of the table and call populateItem manually for that particular row. -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
On Sun, Dec 26, 2010 at 1:20 PM, Alex Shubert alex.shub...@gmail.com wrote: Jeremy thanks for your patience. that last thing is what I meaning. But how to make row call repopulate on it's column. I mean, it is not a problem to visit every child of rowItem and filter all of IColumn descendants. But there are no reason to call populateItem on IColumn as I have no idea what to do with received Components. Is it correct that you this approach suggest to re-implement all class from AbstractDataGridView? Or do I miss something? No, absolutely not. I'd recommend doing it the first way I suggested. But, alas, you don't want to because you think that it will use too many resources. :) In the lack of that, you'll have to play around with iterating through the columns for the row and repopulate them. P.S. : it is strange a bit, but I did not set reusable strategy... and still no #populateItem calls. I have to look in the sources, I guess. Breakpoints are your friend. If you think there's a bug, create a quickstart and send it in. You'll likely find your problem while doing so. -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Editable DefaultDataTable
DefaultDataTable.setItemReuseStrategy(DefaultItemReuseStrategy.getInstance()); doent change anything. ICellPopulator#populateItem is not called. Something is broken in the Danish Kingdom Or in my Wicket knowledge :) On 26 December 2010 22:27, Jeremy Thomerson jer...@wickettraining.com wrote: On Sun, Dec 26, 2010 at 1:20 PM, Alex Shubert alex.shub...@gmail.com wrote: Jeremy thanks for your patience. that last thing is what I meaning. But how to make row call repopulate on it's column. I mean, it is not a problem to visit every child of rowItem and filter all of IColumn descendants. But there are no reason to call populateItem on IColumn as I have no idea what to do with received Components. Is it correct that you this approach suggest to re-implement all class from AbstractDataGridView? Or do I miss something? No, absolutely not. I'd recommend doing it the first way I suggested. But, alas, you don't want to because you think that it will use too many resources. :) In the lack of that, you'll have to play around with iterating through the columns for the row and repopulate them. P.S. : it is strange a bit, but I did not set reusable strategy... and still no #populateItem calls. I have to look in the sources, I guess. Breakpoints are your friend. If you think there's a bug, create a quickstart and send it in. You'll likely find your problem while doing so. -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Best regards Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org