How can I apply correctly a radio button in a grid extjs? -
i working locally. used function display radio button inside grid, , call function in renderer
. know it's wrong, show want.
i don't know how apply radio button work each row.
i use extjs 3.4.
sorry english , disorder.
this array:
var data_metas = [['ingrese meta n°1','','','','','','100%','100%'], ['ingrese meta n°2','','','','','','100%','100%'], ['ingrese meta n°3','','','','','','100%','100%']];
this arraystore:
var store_grid_metas = new ext.data.arraystore({ fields: [ {name: 'meta'}, {name: '100%'}, {name: '75%'}, {name: '50%'}, {name: '25%'}, {name: '0%'}, {name: 'ponderación'}, {name: 'nota final'} ] }); store_grid_metas.loaddata(data_metas);
the "radiogrid" function:
function radiogrid (value) { return "<input type='radio' name = 'primaryradiometauno' " + (value ? "checked='checked'" : "") + ">"; }
and grid:
var grid_metas = new ext.grid.gridpanel({ store : store_grid_metas, id : 'grid_metas', striperows : true, height : 500, width : '100%', autoscroll : true, frame : true, border : true, columnlines : true, stateful : true, clickstoedit: 1, items: [{ xtype: 'button', itemid: 'btn_guardar_meta', icon: '../../icons/add.png', scale: 'small', text: '<b>ingresar metas</b>', handler: function(){ //modal_agregar_metas(); } }], columns:[{ xtype: 'gridcolumn', dataindex: 'meta',name: '', header: 'meta', sortable: true, grupable:true, width: 400, },{ xtype: 'gridcolumn', dataindex: '100%',name: '', header: '100%', sortable: true, grupable:true, align: 'center', width: 50, renderer : radiogrid },{ xtype: 'gridcolumn', dataindex: '75%',name: '', header: '75%', sortable: true, grupable:true, align: 'center', width: 50, renderer : radiogrid },{ xtype: 'gridcolumn', dataindex: '50%',name: '', header: '50%', sortable: true, grupable:true, align: 'center', width: 50, renderer : radiogrid },{ xtype: 'gridcolumn', dataindex: '25%',name: '', header: '25%', sortable: true, grupable:true, align: 'center', width: 50, renderer : radiogrid },{ xtype: 'gridcolumn', dataindex: '0%',name: '', header: '0%', sortable: true, grupable:true, align: 'center', width: 50, renderer : radiogrid },{ xtype: 'gridcolumn', dataindex: 'ponderación',name: '', header: 'ponderación', sortable: true, grupable:true, width: 150 },{ xtype: 'gridcolumn', dataindex: 'nota final',name: '', header: 'nota final', sortable: true, grupable:true, width: 150 }], })
the code display this:
perhaps try listener on grid handles cellclick event. using parameters ext passes handler, can access store record set or values needed:
function(grid, rowindex, columnindex, e) { var record = grid.getstore().getat(rowindex); // record var fieldname = grid.getcolumnmodel().getdataindex(columnindex); // field name var data = record.get(fieldname); }
Comments
Post a Comment