[eluser]Roberto Miguez[/eluser]
I read early today some guys asking about select only one row per time. I did something that I think can help. I don't know how to change the code making able to select only one but I changed my code to:
Code:
function test(com,grid)
{
if (com=='Delete')
{
confirm('Delete ' + $('.trSelected',grid).length + ' items?')
}
else if (com=='Edit')
{
var numSelectRows = $('.trSelected').size();
if (numSelectRows == 1) { alert("ID: " + $('.trSelected td:first div').text()); } /* Informa o ID contido na celula selecionada */
else if (numSelectRows == 0) { alert("You need to select a row to edit."); }
else { alert("Only one row may be edited for time."); }
}
}
This way I can delete more than one row per time and edit only one and I give a message if more than one row are selected for editing or if doesn's have any selected. And you receive as answer the ID of selected row to do your actions.