PDA

View Full Version : How to filter value in editor field (grid)



zyto
17 Sep 2012, 6:11 AM
I try to use Grid, and find not convenient thing for me: I can't change value when user entered in editing mode.
i.e. i have column:

id:'cost', header:'Статья затрат',
dataIndex:'cost_id',
flex:5,
editor : {
xtype : 'combobox',
store : costsStore,
fieldLabel : '',
valueField : 'id',
forceSelection : false,
displayField : 'name',
name : 'cost_id',
minChars : 0,
allowBlank : true


}, renderer : function(value, meta, record) {


var catStore = costsStore;


ind = catStore.find('id', value);
elem = catStore.getAt(ind);
if (!elem) return '';
//return elem.data['name']+" "+value;
return value+" "+elem.data['name'].replace(/\&nbsp\;/g,"\xa0").replace(/^\s+|\s+$/g,"");


}

In values there are strings like:
'   MyString', and I'd like to delete ' ', but delete them only from edit box, but not from list.

screen:
38741

zyto
21 Sep 2012, 1:45 AM
I've made via this.inputEl.dom.value:

id:'cost', header:'Статья затрат',
dataIndex:'cost_id',
flex:5,
editor:{
xtype:'combobox',
store:costsStore,
fieldLabel:'',
valueField:'id',
forceSelection:false,
displayField:'name',
name:'cost_id',
minChars:1,
triggerAction:'all',
typeAheadDelay:100,
typeAhead:true,
queryMode: 'local',
allowBlank:true,
'listeners':{
'focus':function(){
this.inputEl.dom.value = this.inputEl.dom.value.replace(/\ /g,'');
},
'select':function(){
this.inputEl.dom.value = this.inputEl.dom.value.replace(/\ /g,'');
}


}


}

But, to my mind, it is too lowlevel programming.
Is there any other way to change value in edit field, but not change value in the cell?

mitchellsimoens
24 Sep 2012, 7:08 AM
Why not have the text as you want it and then have a template do the indenting?

zyto
25 Sep 2012, 6:29 AM
Because I don't know how to show hierarchical data in standard combobox list.
And with   it is possible:
38918