PDA

View Full Version : EditorSelectionModel no Select!!



galdaka
18 Oct 2006, 1:30 AM
In EditorSelectionModel not works selection mode, only Edition mode. ¿Any example?

jack.slocum
18 Oct 2006, 2:32 AM
Instead of EditorGrid, create a normal grid with an EditorAndSelectionModel.



var sm = new YAHOO.ext.grid.EditorAndSelectionModel();
var grid = new YAHOO.ext.grid.Grid('containerId', dataModel, colModel, sm);

galdaka
18 Oct 2006, 3:54 AM
Este es mi codigo.

ANTES:



grid = new YAHOO.ext.grid.EditorGrid('editor-grid', dataModel, colModel);
grid.getSelectionModel().clicksToActivateCell = 2;
grid.render();

AHORA:


selectionModel = new YAHOO.ext.grid.EditorSelectionModel();
selectionModel.addListener('selectionchange', onSelection);
grid = new YAHOO.ext.grid.Grid('editor-grid', dataModel, colModel, selectionModel);
grid.getSelectionModel().clicksToActivateCell = 2;
grid.render();

NOT WORKS!!!

Me salen los datos, pero hago click en el grid y NO SELECCIONA, si hago dobkle click SI edita.
Al cambiar de página se dispara el evento "onSelection"!! ¿Porque?


var onSelection = function(){
var id = grid.getSelectedRowId();
alert(id);
};

jack.slocum
18 Oct 2006, 7:07 AM
Mira otravez:

var sm = new YAHOO.ext.grid.EditorAndSelectionModel();
var grid = new YAHOO.ext.grid.Grid('containerId', dataModel, colModel, sm);

tienes:

selectionModel = new YAHOO.ext.grid.EditorSelectionModel();