Grid object not matching visible rows

Hi,

we have a grid that is using SmartRendering and also Multiselect so the user can delete multiple rows at once.
In the grid initialization we use the setAwaitedRowHeight option and we use the default css for the grid.

When the user chooses to delete rows from the grid we call the folowing method:

function deleteItems()
{
var item_id = grid.getSelectedRowId();

$.ajax({
	type: "POST",
	async: true,
	url: "/Data/RemoveItem",
	data: {
		item_id: item_id
	},
	success: function (data) {
		if (data == "OK") {
			var ids = item_id.split(',');
			for (var i = 0; i < ids.length; i++) {
				try {
					grid.deleteRow(ids[i]);
				} catch (err) { }
			}
		}
	}
});

}

We load 50 rows before the grid makes a server call and the user can only see 30 rows , so if he selects all 30 of them,
and we start deleting them, somewhere in the middle of the deletion it will load up the onXLS event for all of the remaining rows that arent deleted.

After that the onXLE event is called to fill out the blank space in the grid and if we delete another 30 rows again this time the deleteItems() function
will delete all the rows and onXLE won’t get called because we still have more rows to see before making the server call to get another 50 rows.

Somehow after the second deletion the grid layout is little messed up, i cant multiselect rows and i checked with grid.getAllRowIds() the grid object
still remembers one or more of the old id’s that we deleted but they are not present in the grid.
It seems that the grid object and the rows that we see in the grid are not synced very well.

Can anyone take a look at this?

Unfortunately the only way in case of dynamic loading and row deleting is to delete the rows on the client-side AND on the server-side. More of this, you need to use the prerendering in your grid. In this case the deleting should work correctly. But even after that there may be issues with server-side settings.

Hi Sematik,

Thanks for your reply. Could you provide us with a small codesample illustrating the clientside, serverside and prerendering you are mentioning?

Thanks in advance.

Please, try to include the dataprocessor component to your grid:
docs.dhtmlx.com/doku.php?id=dhtm … cessor:toc
it allows to perform the CRUD operations in dhtmlx components without any custom code

and after the enabling the smart rendering you need to add:
grid.enablePreRendering(buffer)
buffer - number of rows that will be prerendered in addiction to the visible rows.