So basically i am trying to do the same as i did in my previous question - Chained combobox shows valuefield instead of displayfield when changing parent cb BUT now i want to be able to select child combo without picking parent.
Here is what i did to make basic filtering but i've stucked to make it possible to select child cb.
Ext.define('AppTest.CategoryViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.category',
stores: {
categories: {
fields: ['id', 'name'],
proxy: {
type: 'ajax',
url: 'categories.json',
reader: {
type: 'json'
}
}
},
users: {
storeId: 'userStore',
fields: ['id', 'category_id', 'number'],
autoLoad: true,
filters: [{
property:'category_id',
disabled: '{!categoryCombo.selection}',
//disableOnEmpty:true,
value: '{categoryCombo.selection.id}',
/*filter: function (item) {
var me = this,
filterFn = me._filterFn || me.getFilterFn(),
convert = me.getConvert(),
value = me._value;
me._filterValue = value;
console.log(value);
me.isDateValue = Ext.isDate(value);
if (me.isDateValue) {
me.dateValue = value.getTime();
}
if (convert && !me.preventConvert[me.getOperator()]) {
me._filterValue = convert.call(me.scope || me, value);
}
return filterFn.call(me.scope || me, item);
},*/
//extjs is seems to be bugged here, disable doesn't work without it.
updateDisableOnEmpty: function(disableOnEmpty) {
var disabled = this.getDisabled();
if (disableOnEmpty) {
disabled = Ext.isEmpty(this.getValue());
}
this.setDisabled(disabled);
}
//filterFn:function(item){
//console.log(new Error().stack);
//}
}],
proxy: {
type:'ajax',
url:'users.json',
reader: {
type:'json'
}
}
}
}
});
https://fiddle.sencha.com/#fiddle/103r
What am i missing?