PDA

View Full Version : Grid panel and combobox issue



Tuminh112
21 May 2014, 11:50 AM
I'm having issues getting my store on the grid panel to update and render properly from the combobox input. what I mean by this is, when I type into the combobox field, I want it to use the "typeAhead" property and list the selected "displayfield" item, and display the row on the gird panel. Here's my code:
combobox

var comboBox = Ext.create('Ext.toolbar.Toolbar',{ items:[{
store: store,
xtype:'combo',
width:350,
fieldLabel:'Search Title',
displayField:'title',
queryMode: 'local',
buffer:140,
enableKeyEvents: true,
typeAhead:true,
hideTrigger:true


}],
renderTo:Ext.getBody()

});
Grid Panel


var grid = Ext.create('Ext.grid.Panel', {
store: store,
scrollable:true,
autoShow: true,
columns: [
{text: "Title", width: 250, dataIndex: 'title', sortable: true},
{text: "description", width: 500, dataIndex: 'description', sortable: true},
{text: "Link", width: 350, dataIndex: 'link', sortable: true}
],
renderTo:Ext.getBody(),
width: '100%',
height: 350
});

Store


var store = Ext.create('Ext.data.Store', {
model: 'RssFeedModel',
autoLoad: true,
proxy: {
// load using HTTP
type: 'ajax',
url: 'xmlCFFEED.cfm',

// the return will be XML, so lets set up a reader
reader:{
type: 'xml',
// records will have an "Item"
record: 'item',
rootProperty: "channel",
descriptionProperty:"description",
lastbuilddateProperty: "lastbuilddate"
}
}
});

Gary Schlosberg
23 May 2014, 2:45 PM
To clarify, you have a combobox and a grid sharing the same store instance, and you want the item selected in the combo to be selected in the grid panel?

Tuminh112
28 May 2014, 12:06 PM
Yes this is correct. For example, if I have a grid panel that is displaying "row 1: one , row 2: two, row 3: three" and when I type "one" in the combobox, the grid panel should only show "one".