PDA

View Full Version : changing from SingleSelectionModel/EditorSelectionModel



franklt69
22 Feb 2007, 7:55 AM
Hi I need show the data in the grid first in SingleSelectionModel, the user can browse using key arrow. if user do doubleclik on in cell then I need to change to EditorSelectionModel, if user press Esc key or click on a button cancelEdit then again return to SingleSelectionModel, how I can do, I was testing using it but don't get it work.

any help please
Kind regards
Frank

gridAddress.addListener('rowdblclick', this.onCelldblClick, this, true);
},
onCelldblClick : function(gridAddress, rowIndex, columnIndex, e){

//colModelAddress.isCellEditable = function(columnIndex, rowIndex){ return edit; };
/* if (edit == true)
gridAddress.startEditing;
else
gridAddress.stopEditing;*/
},

onEditAddress : function(){
//dlgEditAddress.init();
//edit = true;
smAddress = new YAHOO.ext.grid.EditorSelectionModel();

},
onCancelAddress : function(){
//edit = false;
smAddress = new YAHOO.ext.grid.SingleSelectionModel();

},

tryanDLS
22 Feb 2007, 8:22 AM
I don't think you want to do it that way b/c you'd have to disconnect the selectionmodel and reconnect each time. There is an example in the Examples forum of an extension to the EditorSelectionModel that makes it do rowSelection stuff. Also, this may be native in the 1.0 version.