Our blazing fast Grid component built with pure JavaScript


Post by gregc »

Is there anything I can send back in the JSON to signify that particular rows are selected when I am using the selectionmode checkbox?

I want my previously selected positions already checked off.

Image

I could write some javascript to select the records, but I can't call it until the first AJAX call has finished and the data is in the table.


Post by mats »

Just await your fetch / ajax call and do the selection then?


Post by gregc »

I don't make any fetch calls, its all automatic.

store : {
		readUrl : 'blah'
}

Post by mats »

You don't have to use autoLoad, instead do:

await grid.store.load();

Post by gregc »

Its a major change, I would have to change how my search interacted with the grid, I would have to make sure the grid was rendered, all just to have the rows selected. Probably easier for me to abandon the nice row checkboxes in favor of my own button in the grid.


Post by mats »

So you want selection maintained after you reload store / records?


Post by gregc »

Sure, if I refreshed the page it would return to what my server side store said was selected, which comes from the database.
Its fine though, I need it this week, so I'll just change the JSON to include a toggle button.


Post by Animal »

You can access the data packet that your server sent in the AjaxStore's load event: https://bryntum.com/docs/calendar/api/Core/data/AjaxStore#event-load

If you send back extra properties the store won't read them. It only looks at the properties that it needs to to read its data.

So you can send back other properties which your app can then process in any way.


Post Reply