3.2.0

Deleting a row

I have a row delete working with left mouse click on the row, with

obj.setAction("click", rowDelete);

But of course this not standard functionality, to delete with a mouse click, and I would like to delete a row when the Delete key is pressed. However, I tried

obj.setAction("onkeyup", rowDelete);

and it doesn't work, I guess this event is not implemented. Does anyone have an idea how I can do this?

Thanks

Rich F
February 11,
I would love to know this as well asap!
March 1,
function removeRow(grid)
{
var index = grid.getProperty("selection/index");
if (confirm("Do you really want to delete?"))
{
returnVal = myData.splice(index,1);
grid.setRowProperty("count", myData.length);
grid.refresh();
//alert(" count -> "+obj.getRowProperty("count")+ " |=> Deleted Row: " + returnVal);
}
}

//Set Keydown event

obj.setEvent("onkeydown", readChar);
function readChar(e)
{
var key = e.keyCode;
//alert(e);
switch(key)
{
case 46:
answer = confirm("Are you sure to delete?");
if (answer)
{
removeRow(obj);
}
break;
case 13:
answer = confirm("Are you sure to insert?");
if (answer)
{
addRow(obj);
}
break;
}
}

Note: The above code delete a row from the grid which has been loaded
from the Javascript array

Hope it helps u.....
Ritesh Jagga
November 23,
Ritesh

This looks very helpful. Is there a chance of seeing your "addRow" function as well?

(I think the next beta3 version is supposed to have add/delete row capaility, but this is v. useful nonetheless)

Thanks
Will
Will
November 23,

This topic is archived.

See also:


Back to support forum