alessio77
4 Apr 2012, 2:25 AM
first of all, forgive me for my english.
i've a grid with an editable boolean column
var sxgrid = Ext.create('Ext.grid.Panel', {
id: 'sxGrid',
alias : 'widget.prova',
width: '100%',
title: 'Lavorazione',
selType: 'cellmodel',
columns: [{
text: 'Nome',
xtype: 'gridcolumn',
dataIndex: 'ColumnName',
sortable: true
}, {
text: 'Tipo',
xtype: 'gridcolumn',
dataIndex: 'ColumnType',
sortable: true
}, {
text: 'Lunghezza',
xtype: 'gridcolumn',
dataIndex: 'ColumnLenght',
sortable: true
}, {
text: 'Chiave',
xtype: 'booleancolumn',
dataIndex: 'NaturalKey',
trueText: 'Si',
falseText: 'No',
sortable: true,
editor: {
xtype: 'checkbox',
listeners: { change : this.checkBoxClick }
}
}],
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit:1})
]
});
function checkBoxClick(a,newValue, oldValue, eopts)
{
//how to get reference to the row of the grid that contains the checkbox and changing its background color based on checkbox value
}
how to get the parent object(in my case the row of the grid) and change its color?
i've tryed something like:
a.getParentByType('????') returns always undefined (maybe i've used a wrong xtype, i've tryed with 'grid', 'gridpanel','prova','widget.prova','app.widgetprova' i don't' know the xtype of a row if exists) anyway it returns always undefined
but i don't know how to get reference to a parent/container or an ancestor of component in a grid
i can't proceed over, maybe i should use another approach?
i've seen a lot of examples that use 'Ext.selection.CheckboxModel' to select a row whith a checkbok but itsn't suitable for me.
(i'd like to have an editable custom column not at the beginnig of the grid, with a text in the header and not a checkbox userd to prerform 'select all row')
anyway, every suggestion is appreciated
thanks a lot sencha friends :-)
i've a grid with an editable boolean column
var sxgrid = Ext.create('Ext.grid.Panel', {
id: 'sxGrid',
alias : 'widget.prova',
width: '100%',
title: 'Lavorazione',
selType: 'cellmodel',
columns: [{
text: 'Nome',
xtype: 'gridcolumn',
dataIndex: 'ColumnName',
sortable: true
}, {
text: 'Tipo',
xtype: 'gridcolumn',
dataIndex: 'ColumnType',
sortable: true
}, {
text: 'Lunghezza',
xtype: 'gridcolumn',
dataIndex: 'ColumnLenght',
sortable: true
}, {
text: 'Chiave',
xtype: 'booleancolumn',
dataIndex: 'NaturalKey',
trueText: 'Si',
falseText: 'No',
sortable: true,
editor: {
xtype: 'checkbox',
listeners: { change : this.checkBoxClick }
}
}],
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit:1})
]
});
function checkBoxClick(a,newValue, oldValue, eopts)
{
//how to get reference to the row of the grid that contains the checkbox and changing its background color based on checkbox value
}
how to get the parent object(in my case the row of the grid) and change its color?
i've tryed something like:
a.getParentByType('????') returns always undefined (maybe i've used a wrong xtype, i've tryed with 'grid', 'gridpanel','prova','widget.prova','app.widgetprova' i don't' know the xtype of a row if exists) anyway it returns always undefined
but i don't know how to get reference to a parent/container or an ancestor of component in a grid
i can't proceed over, maybe i should use another approach?
i've seen a lot of examples that use 'Ext.selection.CheckboxModel' to select a row whith a checkbok but itsn't suitable for me.
(i'd like to have an editable custom column not at the beginnig of the grid, with a text in the header and not a checkbox userd to prerform 'select all row')
anyway, every suggestion is appreciated
thanks a lot sencha friends :-)