fetchData() not getting called on the 2nd click of a button

Hi,

I have a pop-up screen which is shown on click of a ‘Add’ button in the parent window. In the pop-up window I have a listgrid and a ‘Select’ button.
On selecting a record in the listgrid and clicking on the ‘Select’ button, the record from the pop-up window will be added to the listgrid in the parent window.

Now, again if I click on the ‘Add’ button, I need to call the fetchData() and bring the data in the pop-up listgrid from the database, after doing some data massaging in the Java side. This massaging is done because I don’t want the record which I had added in the earlier click of ‘Select’ to appear on the pop-up again.

But right now, on the 2nd click of the button, Java method is not called.
Instead, it’s taking data from the result of the earlier fetchData(). So I am getting the same record again which I had added in the parent window.

How I can make it to hit the Servlet again and do the desired massaging to bring up the data.

Thanks.

See the documentation for fetchData(). There is automatic caching, and you can avoid it via grid.data.invalidateCache().

Hi,
I did grid.data.invalidateCache().
But I am getting a javascript error saying “Object doesn’t support this property or method”.

By “grid”, we meant the ID property provided to your grid (or a reference to it you have obtained in another way).

Yes.

I wrote listGridTest.data.invalidateCache(), just before doing listGridTest.fetchData(),
where listGridTest’ is the ID of that listGrid.

Done correctly that definitely will not lead to “Object doesn’t support this property or method”. If you think you’ve found a bug in SmartClient, please put together an Issue Report as detailed in the Debugging topic.