How to properly fire an event on inline cell edit

1,666 views
Skip to first unread message

mgalvin

unread,
Mar 16, 2010, 11:46:02 AM3/16/10
to SlickGrid
Hi,

I am wondering what the proper/best way is to fire off an event when a
cell is edited in SlickGrid. Here is what I am trying to do:

Fill a grid with a bunch of data.
When a user clicks on a cell, allow that cell to be edited.
For the given cell, onblur (or on row change) trigger an event that
saves the row back to a database. (The row will also need to have a
(possibly hidden) id field so I now what db record id it is).

How do i make the event fire (what callback?). How do I best get at $
(this) row?

Also, is it possible to resize the grid... say, have it be 500x500
then click a button to make it fill the window while setting the z-
index to the highest on the page (i know i need to do this part). The
question is, will it resize properly? Any know issues?

Thanks,

Matt

Michael Leibman

unread,
Mar 16, 2010, 12:34:30 PM3/16/10
to slic...@googlegroups.com
Matt,

You can subscribe to the onCellChange change event that gets called immediately after a cell has been edited.  If you need more control (additional validation?), you can specify setValueHandler on a column definition and perform data update manually.  In both cases, the context is passed in the callback parameters:

setValueHandler(newValue,columnDef,dataItem)
onCellChange(row,cell,dataItem)

As for resizing, one of the examples has that.  You can resize the container and call grid.resizeCanvas() to update the grid.

mgalvin

unread,
Mar 16, 2010, 12:52:15 PM3/16/10
to SlickGrid
Awesome, thanks Michael! I will give them a try.

I am in the process of trying to use SlickGrid for a project and so
far it seems incredible!

I will let you know how it all turns out.

Thanks,

Matt

On Mar 16, 12:34 pm, Michael Leibman <michael.leib...@gmail.com>
wrote:

Daniel Souchon

unread,
Aug 26, 2013, 11:05:53 AM8/26/13
to slic...@googlegroups.com
I am struggling with the fact that onCellChange only fires when you click outside the cell after using a cell editor.
Is there a way to make it fire as soon as you have chosen a date from the datepicker/dropdownlist in the cell?
I want to be able to click a Save button but need to update my data on cell change.
But onCellChange is only being called after clicking in another cell in the grid
Reply all
Reply to author
Forward
0 new messages