How do i can check for unselect in grid row?

I already delete 1 notice data. And try again.
The value is before select key that deleted.
Maybe this is error or i don’t use right way.
I want to check the unselected row state.

please check my code.

[Code]
// noticeList is dhx.Grid Object

var notices = noticeList.selection.getCells();
var notice = noticeList.selection.getCell();

		if(notices.length == 0) {   				
			dhx.alert({
				header: "Error",
				text : "please select notice to delete ",
				buttonsAlignment : "center",
				buttons : ["OK"]
			}); 				
		
		} else {
                           //delete process
                    }

In your case you are using multi selection and deleting all that are selected, right?

I made some code with some ways of deleting, including multi selection. I realized that when deleting the array with the selected lines, there is no time for the grid to render, so I used dhx.awaitRedraw() and inside delete the line, and it worked.

In the example I created a checkbox column to select the rows and delete. That way you don’t need to use awaitRedraw().

I don’t know if this is exactly what you need.
But I hope this example helps you, follow the example.

https://snippet.dhtmlx.com/cs2gsgcu

thanks for your reply.

I solved this way.
selection remove After delete process.
And I will consider your recommend that change checkbox.
thank you DouglasMeirelles.

[ My code ]
var notice = noticeList.selection.getCell();
if(notices.length == 0) {
dhx.alert({
header: “Error”,
text : "please select notice to delete ",
buttonsAlignment : “center”,
buttons : [“OK”]
})
} else {
//delete process … //
noticeList.selection.removeCell(); // selection remove After delete process.
}

1 Like