PDA

View Full Version : "TreeCombo" plugin in editable TreeGrid shows valuefield instead of displayField



JackJohnsonX
16 Jan 2015, 3:41 PM
Here is a link to the code for the custom TreeCombo
http://www.sencha.com/forum/showthread.php?198856-Ext.ux.TreeCombo

//tree panel

Ext.define("MyAppp.view.tree.Edit",{
extend:"Ext.tree.Panel",
alias:"widget.myapp_tree_edit",
requires:["MyApp.plugins.TreeCombo"],
rootVisible:false,


initComponent:function() {

this.cellEditing = new Ext.grid.plugin.CellEditing({
clicksToEdit: 2
});

this.plugins = [this.cellEditing];


this.columns = [
{
xtype: "treecolumn",
header: "blah",
flex: 1,
sortable: true,
dataIndex: "text",
flex:2,
editor:"textfield"
},
{
header:"Segment",
dataIndex:"SEG",
flex:1,
editor:{xtype:"treecombo", store:"Trees", treeWidth:210, displayField:"text", valueField:"id", canSelectFolders: false}
},
................................


The custom treecombo editor shows perfectly fine on cell dbl click but after making a selection from the tree, the cell is updated with "id" instead of the "text"

I have not tried it yet but I think one possible solution would be to listen for itemclick on tree then update the grid record with record.data.text. But one problem i foresee is how will i know which record to update? since the event will be fired from the grid editor, in this case treecombo, and not the grid itself.

lumberjack
20 Jan 2015, 8:34 AM
You'll likely need to add a custom renderer function to your column to retrieve the proper displayText information.

Regards,
Brian

gov