Asiaapollo Posted January 22, 2013 Posted January 22, 2013 Hi Farshad Mohajeri, In TuniDBGrid, is it possible to start cell editing when key pressed? I found some related post in below url: http://forums.ext.net/showthread.php?17515-CLOSED-GridPanel-start-cell-editing-when-key-pressed When I put below code in ClientEvents.ExtEvents, it doesn't work! function OnKeydown(e) { var me = this, grid = me.grid, selModel = grid.getSelectionModel(), record, char = String.fromCharCode(e.getKey()); pos = selModel.getCurrentPosition(); record = grid.store.getAt(pos.row); columnHeader = grid.headerCt.getHeaderAtIndex(pos.column); me.startEdit(record, columnHeader); record[columnHeader.dataIndex] = char; Ext.Function.defer(function () { columnHeader.getEditor().field.fireKey(e.RIGHT); },50); } Quote
Asiaapollo Posted January 28, 2013 Author Posted January 28, 2013 No one interest on such functionality? Quote
Asiaapollo Posted January 28, 2013 Author Posted January 28, 2013 After weeks of searching Ext documents, I've finally solved it. Please ignore it. Quote
Administrators Farshad Mohajeri Posted January 29, 2013 Administrators Posted January 29, 2013 Please share your solution with community. Quote
Asiaapollo Posted January 30, 2013 Author Posted January 30, 2013 Hi Farshad, Since there is no reply on this topic, I thought no one interest on such functionality. If any one interested, please add a client event to TuniDBGrid as shown below. ClientEvents.ExtEvents.add( 'OnKeypress=function OnKeypress(e)'#13#10+ '{ var me = '+JSName+','#13#10+ ' pos = me.getSelectionModel().getCurrentPosition(),'#13#10+ ' chrCode = e.getCharCode(),'#13#10+ ' record = me.store.getAt(pos.row),'#13#10+ ' colname= me.columns[pos.column].dataIndex,'#13#10+ ' xplugin = me.getPlugin("uniCellEditor"),'#13#10+ ' char = String.fromCharCode(chrCode);'#13#10+ ' record.beginEdit();'#13#10+ ' record.set(colname, char);'#13#10+ ' xplugin.startEditByPosition(pos);'#13#10+ '}'); The most difficult part is I coundn't figure the TuniDBGrid obj in keypress event ("this" didn't work), so I finally use TuniDBGrid.JSName. For me, it works perfectly, but I haven't tested with readonly column. 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.