PDA

View Full Version : Reading template column values from grid



chetan.nellekeri
23 Aug 2013, 4:10 AM
I am using templateColumn in grid. In that templateColumn, I am using a text input filed. I am able to bind the data to that column. But how can you read the values from templateColumn after updating the templateColumn.

Thanks in advance

mankz
23 Aug 2013, 6:33 AM
A bit hard to understand the use case, try to provide a more clear description with screenshots of what you want to achieve.

chetan.nellekeri
27 Aug 2013, 12:57 AM
I am using grid. In that grid i have a requirement in column i should display a textfield or checkbox based on some condition.For achieving that i used templateColumn. I am able to show the data in that column when I bind a store to that grid. If I want to save the data in that column to the database I need to read those values of that templatecolumn. How can I read those values from the template column?


45555

Below is code I used..


var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});

var displayGrid = Ext.create('Ext.grid.Panel',{
name: tplDetails.get("id"),
id: tplDetails.get("id")+'Grid',
margin:'2 2 2 2',
stripeRows : true,
//store: 'manualFieldStr',
columns: [
{header: '', dataIndex: 'newFieldIndicator', width: 50},
{header: 'Name', dataIndex: 'fieldNameDisplay', width: 250},
{header: 'Description',dataIndex: 'description', width: 250,
field: {
allowBlank: true
}
},
{header: 'Default Value',xtype:'templatecolumn',
tpl: '<div align="center">'+
'<tpl if="booleanField==true">'+
'<input type="checkbox">'+
'<tpl else>'+
'<input type="text" value="{defaultValue}" style="min-width:200px;max-width:200px;">'+
'</tpl>'+
'</div>',
width: 210
},
{header: 'Max Value', dataIndex: 'maxLength', flex: 1,
field: {
allowBlank: true
}
}
],
plugins: [cellEditing]
});