RE: [Wicket-user] Question about DataTable and IDataProvider restated
Me: I suppose the usual approach is to trigger the download of IDataProvider's data via the event handler of the submit button. That way, the data would be available for both Iterator IDataProvider.iterate(first, count) and int IDataProvider.size(). Eelco Hillenius Sent: Tuesday, April 04, 2006 5:58 PM: It's the responsibility of the model(s). Components may rely on models being properly initialized and available whenever they want to access them. Model implementations may or may implement detachable behavior, caching etc. Perhaps the method IModel IDataProvider.model(Object) has something to do with this. How is this method to be used? However, I do not have a single submit button - I have various sets of radio-buttons and a change to any one causes an immediate postback. I do not want to code an event handler for each one of them; I'd rather put my database query in a method that is called before the page is rendered _regardless_ of the reason. Can you suggest a suitable method? Eelco: So, make that part of your model's implementation. Look at for example LoadableDetachableModel for ideas, or you can use the implementation directly too if you want. I am guessing that the input to IModel IDataProvider.model(Object) is some object in the session that provides the information needed for the database download. Any IDataProvider method that needs database data, e.g. int count() and Iterator iterate(first,count) must call IModel IDataProvider.getModel(Object) to get the wrapper, and then ask that wrapper to provide the database-filled result. In this way, whichever IDataProvider method needs the database data first is the one that causes the database refresh. Is that the idea? --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid0944bid$1720dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Question about DataTable and IDataProvider restated
no, the model() is there to wrap every object returned from the iterator() call in its own (detachable) model. this model is used in Item components which represent a rows inside a dataview.-Igor On 4/5/06, Frank Silbermann [EMAIL PROTECTED] wrote: Me: I suppose the usual approach is to trigger the download of IDataProvider's data via the event handler of the submit button. That way, the data would be available for both Iterator IDataProvider.iterate(first, count) and int IDataProvider.size().Eelco Hillenius Sent: Tuesday, April 04, 2006 5:58 PM: It's the responsibility of the model(s). Components may rely on models being properly initialized and available whenever they want to access them. Model implementations may or may implement detachable behavior, caching etc.Perhaps the method IModel IDataProvider.model(Object) has something todo with this.How is this method to be used? However, I do not have a single submit button - I have various setsof radio-buttons and a change to any one causes an immediate postback. I do not want to code an event handler for each one of them; I'd ratherput my database query in a method that is called before the page is rendered _regardless_ of the reason.Can you suggest a suitable method? Eelco: So, make that part of your model's implementation. Look at for example LoadableDetachableModel for ideas, or you can use the implementation directly too if you want.I am guessing that the input to IModel IDataProvider.model(Object) issome object in the session that provides the information needed for thedatabase download.Any IDataProvider method that needs database data,e.g. int count() and Iterator iterate(first,count) must call IModel IDataProvider.getModel(Object) to get the wrapper, and then ask thatwrapper to provide the database-filled result.In this way, whichever IDataProvider method needs the database datafirst is the one that causes the database refresh. Is that the idea?---This SF.Net email is sponsored by xPML, a groundbreaking scripting languagethat extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!http://sel.as-us.falkag.net/sel?cmdlnkkid0944bid$1720dat1642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Question about DataTable and IDataProvider restated
I suppose the usual approach is to trigger the download of IDataProvider's data via the event handler of the submit button. That way, the data would be available for both Iterator IDataProvider.iterate(first, count) and int IDataProvider.size(). It's the responsibility of the model(s). Components may rely on models being properly initialized and available whenever they want to access them. Model implementations may or may implement detachable behavior, caching etc. However, I do not have a single submit button – I have various sets of radio-buttons and a change to any one causes an immediate postback. I do not want to code an event handler for each one of them; I'd rather put my database query in a method that is called before the page is rendered _regardless_ of the reason. Can you suggest a suitable method? So, make that part of your model's implementation. Look at for example LoadableDetachableModel for ideas, or you can use the implementation directly too if you want. Eelco --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid0944bid$1720dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
RE: [Wicket-user] Question about DataTable and IDataProvider restated
I suppose the usual approach is to trigger the download of IDataProviders data via the event handler of the submit button. That way, the data would be available for both Iterator IDataProvider.iterate(first, count) and int IDataProvider.size(). However, I do not have a single submit button I have various sets of radio-buttons and a change to any one causes an immediate postback. I do not want to code an event handler for each one of them; Id rather put my database query in a method that is called before the page is rendered _regardless_ of the reason. Can you suggest a suitable method? I tried putting the database query in Iterator IDataProvider.iterate(first, count) but that doesnt seem to work, perhaps because it comes too late for int IDataProvider.size() to have the information. Putting the database query in int IDataProvider.size() may simply reverse the problem. Into which method _should_ I place the database query? What are my options? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Frank Silbermann Sent: Tuesday, April 04, 2006 3:33 PM To: wicket-user@lists.sourceforge.net Subject: RE: [Wicket-user] ?Contract for Iterator IDataProvider.iterator(int first, int count) ??? I have a question about the intended use of the DataTable components provided in Wicket Extensions. The DataTable relies upon an IDataProvider to provide the data. To do this, we implement: Iterator iterate(first, count) Lacking any advice to the contrary, I assumed that this is the method which would retrieve data from the database, but this does not seem to be working well for me. My database query is parameterized based on page-component model values, and these may change with each rendering. My problem is that when one rendering presents a short data set, on the next rendering the DataTable is not always requesting all of the rows. The count seems to be affected by the number of rows returned by the previous rendering. I suspect this is because my implementation of int DataProvider.size() assumes that it will be called _after_ Iterator iterate(first, count) pulls down the data so its always one rendering behind. Should I give the int IDataProvider.size() method the responsibility for figuring out the query string and going to the database? (How else would it be able to tell the DataProvider how many rows to request?)
Re: [Wicket-user] Question about DataTable and IDataProvider restated
there is nothing to trigger for idataprovider. whenever the datatable renders it will call the appropriate methods. simply make your dataprovide have a reference to your form model and then use that as the criteria for quieries in both size and iterator. -IgorOn 4/4/06, Frank Silbermann [EMAIL PROTECTED] wrote: I suppose the usual approach is to trigger the download of IDataProvider's data via the event handler of the submit button. That way, the data would be available for both "Iterator IDataProvider.iterate(first, count)" and "int IDataProvider.size()". However, I do not have a single submit button – I have various sets of radio-buttons and a change to any one causes an immediate postback. I do not want to code an event handler for each one of them; I'd rather put my database query in a method that is called before the page is rendered _regardless_ of the reason. Can you suggest a suitable method? I tried putting the database query in "Iterator IDataProvider.iterate(first, count)" but that doesn't seem to work, perhaps because it comes too late for "int IDataProvider.size()" to have the information. Putting the database query in "int IDataProvider.size()" may simply reverse the problem. Into which method _should_ I place the database query? What are my options? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Frank Silbermann Sent: Tuesday, April 04, 2006 3:33 PM To: wicket-user@lists.sourceforge.net Subject: RE: [Wicket-user] ?Contract for Iterator IDataProvider.iterator(int first, int count) ??? I have a question about the intended use of the DataTable components provided in Wicket Extensions. The DataTable relies upon an IDataProvider to provide the data. To do this, we implement: "Iterator iterate(first, count)" Lacking any advice to the contrary, I assumed that this is the method which would retrieve data from the database, but this does not seem to be working well for me. My database query is parameterized based on page-component model values, and these may change with each rendering. My problem is that when one rendering presents a short data set, on the next rendering the DataTable is not always requesting all of the rows. The "count" seems to be affected by the number of rows returned by the previous rendering. I suspect this is because my implementation of "int DataProvider.size()" assumes that it will be called _after_ "Iterator iterate(first, count)" pulls down the data – so it's always one rendering behind. Should I give the "int IDataProvider.size()" method the responsibility for figuring out the query string and going to the database? (How else would it be able to tell the DataProvider how many rows to request?)