victorymoon
23 Jul 2012, 6:11 AM
Hi Guys,
I am creating a combobox with two actions. One is while typing something on the combobox another is clicking the trigger on the combo box
Action #1. When a user types something i need to show matching results, when he select a result from the dropdown, he need to be redirected to that details page and the selected element (i.e) searched string has to be saved in the local storage for listing recently search items
Action #2. When you click, on the trigger button which is available in the combobox, i need show the data list, which are the recently searched by the user.
I am facing the issue while switching two stores. i can update the stores but the data items is not getting listed after the updation.
Any idea on this?
Below is the code for switching back the stores.
Ext.define('abc.view.account.AccountSearchField', {
extend: 'abc.component.GroupingComboBox',
alias: 'widget.accountSearchField',
inject: ['accountSearchLocalStore','accountStore'],
minChars : 5,
enforceMaxLength: true,
maxLength : 30,
anyMatch: true,
groupField: ['searchTypeDesc'],// string or array
valueField: 'accountId',
displayField: 'accountNm',
queryMode: 'remote',
typeAhead: true,
hideTrigger: false,
emptyText: 'Account Lookup',
multiSelect: false,
allowBlank: true,
enableKeyEvents: true,
listeners: {
'beforequery': function(qe) {
},
render:function(){
console.log('Before Render' + this);
Ext.select('.x-form-arrow-trigger').on('click',function() {
});
},
expand:function(){
},
blur: function(){
this.store = this.ownerCt.accountSearchLocalStore;
},
focus: function(){
},
select:function() {
this.store = this.ownerCt.accountSearchLocalStore;
this.store.load();
this.store.add({accountNm: this.lastValue});
this.store.sync();
console.log('!!Local Data added!!');
console.log(this.store);
},
change: function(){
this.store= this.ownerCt.accountStore;
console.log('!!on type added!!');
console.log(this.store);
console.log('!!on type ended!!');
},
keydown:function(){
}
},
features: [{ftype:'grouping'}],
listConfig: {
loadingText: 'Searching...',
emptyText: 'No matching posts found.',
// Custom rendering template for each item
getInnerTpl: function() {
return '<div class="search-item">' +
'<h3>{searchTypeDesc}</h3>' +
'<div>{accountNm}</div>' +
'</div>';
}
}
});
I am creating a combobox with two actions. One is while typing something on the combobox another is clicking the trigger on the combo box
Action #1. When a user types something i need to show matching results, when he select a result from the dropdown, he need to be redirected to that details page and the selected element (i.e) searched string has to be saved in the local storage for listing recently search items
Action #2. When you click, on the trigger button which is available in the combobox, i need show the data list, which are the recently searched by the user.
I am facing the issue while switching two stores. i can update the stores but the data items is not getting listed after the updation.
Any idea on this?
Below is the code for switching back the stores.
Ext.define('abc.view.account.AccountSearchField', {
extend: 'abc.component.GroupingComboBox',
alias: 'widget.accountSearchField',
inject: ['accountSearchLocalStore','accountStore'],
minChars : 5,
enforceMaxLength: true,
maxLength : 30,
anyMatch: true,
groupField: ['searchTypeDesc'],// string or array
valueField: 'accountId',
displayField: 'accountNm',
queryMode: 'remote',
typeAhead: true,
hideTrigger: false,
emptyText: 'Account Lookup',
multiSelect: false,
allowBlank: true,
enableKeyEvents: true,
listeners: {
'beforequery': function(qe) {
},
render:function(){
console.log('Before Render' + this);
Ext.select('.x-form-arrow-trigger').on('click',function() {
});
},
expand:function(){
},
blur: function(){
this.store = this.ownerCt.accountSearchLocalStore;
},
focus: function(){
},
select:function() {
this.store = this.ownerCt.accountSearchLocalStore;
this.store.load();
this.store.add({accountNm: this.lastValue});
this.store.sync();
console.log('!!Local Data added!!');
console.log(this.store);
},
change: function(){
this.store= this.ownerCt.accountStore;
console.log('!!on type added!!');
console.log(this.store);
console.log('!!on type ended!!');
},
keydown:function(){
}
},
features: [{ftype:'grouping'}],
listConfig: {
loadingText: 'Searching...',
emptyText: 'No matching posts found.',
// Custom rendering template for each item
getInnerTpl: function() {
return '<div class="search-item">' +
'<h3>{searchTypeDesc}</h3>' +
'<div>{accountNm}</div>' +
'</div>';
}
}
});