Hi Team,
we have configured context menu options that will enable user to add new row in the grid using “Insert row above” or “Insert row below”. but this only add a single row. Is there a way to add multiple new rows using context menu or using keyboard?
thanks
Ashmi
Hi @rohit.parwal
adding and deleting for rows and columns is handled by alter
method. Its last argument is amount
. If you type
alter('insert_row', 10, 5)
the method will add 5
rows above row with an index of 10
(and the previous 10
rows will be shifted down, if it existed in the first place).
If you want to add rows by keyboard shortcuts you can use the afterDocumentKeyDown
hook to pass alter
method.
is there a way to do this with custom context menu option?
Sure @rohit.parwal
Here is a working example http://jsfiddle.net/handsoncode/n46jyrq4/
I have added two options
- Add 5 rows below selected row
- Add 5 rows above selected row