Hi,
I can't imagine it will depend on the tab being active if dataArrivedHandler is called.
Are you sure your ListGrids exists (no lazy-load on select, no destroy/recreate on select)?
Perhaps try this in a small testcase.
Best regards
Blama
Announcement
Collapse
No announcement yet.
X
-
@Blama
It does. But only if tab is active.
For instance, you have 5 tabs each have Auto Refresh ListGrid .
Here, at a time in tabset only one tab will be selected. Now refresh will call 5 invalidateCache(), for each grid, but dataArrive() will be invoked for only one active/selected tab's listGrid.
When you select/activate tab then only dataArrive() function invoke.
This is how my smartClient 10.0 works.
Leave a comment:
-
Hi,
invalidateCache() will always trigger dataArrived, won't it?
Best regards
Blama
Leave a comment:
-
Blama
Trouble again, I save selected rows and , trying to select them back in dataArrived handler.
But dataArrived is invoked only if new data arrive,
In that case i loose my selection,
Is there any alternate function ?
Poonam.
oh, realize.
Its not calling dataArrive handler because ListGrid is in tab and that tab is not active. UI invoke dataArrive only for active tab. List grid get refreshed but data not arrived.Last edited by ppratik; 29 Aug 2017, 07:01.
Leave a comment:
-
Addition:
If not all records are on the 1st page (e.g. 75 rows), I can think of three solutions:- Act on dataArrived, if not all records are included, directly fetch them from the DS via primaryKey (suggestion from #5, don't know if it will work)
- Use a bigger page size that will include all records that are typically selected (will fail if there are either many new records and that arbitrary new number is still too small).
- Somehow(?) include the selected records in the invalidateCache-request, use a custom select to create a SQL UNION of your selected records and the normal ones. That way, you won't even need a SortNormalizer - just add a column with customSelectExpression="1" and return "0" for that column in the UNION.
Best regards
Blama
Leave a comment:
-
Hi,
ah, yes. Saving before refresh is most likely more easy.
Then just see the JS version of SortNormalizer. The docs you have are the correct ones.
You have your ListGrid record in the SM. Apply the SM to one column and always sort on that column (can be hidden, too).
In your code access your stored list of selected rows and if the row is selected return 0, else 1.
Best regards
Blama
Leave a comment:
-
Isomorphic
i cant find proper documentation for sortnormalizer
Please see link below.
https://www.smartclient.com/smartcli...sortNormalizer
Thanking you.
Leave a comment:
-
I am doing it slightly different way,
I invalidateCache() in timer and at the same time also find and store getSelectedRecords()
Instead of dataArrived(), I set selection row back in ds.transformResponse function.
so, row selection are always there, but sometime at 6th page or 2nd page as more than 300 data are received in update.
Thanking you.
Poonam.
I use Version v10.0p_2015-01-14/PowerEdition Development Only (2015-01-14)
Leave a comment:
-
Hi ppratik,
I'm not sure if this is possible easily at all. See this sample and replace the button with this code:
Code:isc.Button.create({ ID: "buttonDownload", width:200, title: "Refetch", click: function () { listGridSuppyItem.fetchData(initialCriteria); } });
I don't think it is possible to preserve the selection here out o the box? Is it?
My gut feeling says: SelectionStateChanged-handler, saving the selection on change and re-apply it on dataArrived. If rows are missing, requery only those from the DS by primaryKey, (hoping that the ListGrid will include them in its data set).
Best regards
Blama
Leave a comment:
-
Start by reading the docs for sortNormalizers. Your attempt above looks like you just made up an API rather than actually looking at the docs.
Leave a comment:
-
Isomorphic
Pleasae provice example where, sortNormalizer can return selected rows.
Please find below, I tried below code, does not seem to be working.
sortNormalizer: function (record, field, context) {
return context.getSelected();
}
anything wrong here ?
Do I need to return rownumber ??\\
Thank you.
Leave a comment:
-
Keep selected row at top on refresh
Hello,
I use listGrid which need to be refreshed every minutes, as we have data updated every seconds.
I have sorted data on dateTime , so latest data are always on top.
Now AutoRefresh invoke fetchData every minute and sometime selected row get disappear. The display limitation is only 75 rows, and then it loads on scroll down.
How can I keep selected rows on top , regardless of sort field?
Thanking you
Tags: None
Leave a comment: