When I call the mygrid.getCheckedRows(0)
It returns a comma separated list
like this 1,2,3,4.
This is fine but what I really need is the total of
selected row , in this case 4.
Is there a way to achieve this goal.

Thank you

you may try to cerate a js array from a list and get the number of elements of the array.

var selectedRowCount = mygrid.getSelectedRowId().split(",").length;