PDA

View Full Version : Live Search combo in Grid?



parsbin
22 Jun 2011, 3:41 AM
hi
can i use my live search combo as a element in a grid?
how can do this?
my live search code:


var ds = new Ext.data.Store({
url: '../search/json_core.php',
reader: new Ext.data.JsonReader({
root: 'comps',
totalProperty: 'totalCount'
}, [
{name: 'name', mapping: 'name'},
{name: 'id', mapping: 'id'},
{name: 'type', mapping: 'type'},
{name: 'description', mapping: 'description'},
{name: 'date', mapping: 'date'}
])
});
var resultTpl = new Ext.XTemplate(
'<tpl for="."><div class="search-item" dir=rtl>',
'<h3>{name}<span>{date}<br /> {type}</span></h3>',
'{description}',
'</div></tpl>'
);
var search = new Ext.form.ComboBox({
store: ds,
displayField:'name',
valueField:'id',
cls: 'textright',
typeAhead: false,
loadingText: '... ?? ??? ?????',
width: 383,
pageSize:10,
hideTrigger:true,
minChars: 2,
tpl: resultTpl,
itemSelector: 'div.search-item',
listeners: {
'select': function(cb, record){
form_middle.getForm().reset();
var contact_id = record.get('id') ;
var contact_name = record.get('name') ;

Ext.getCmp('forooshande_id').setValue(contact_id);
/////////middle address form fill
Ext.getCmp('name_shakhs').setValue(contact_name);


//shomare_eghtesadi
Ext.Ajax.request({
url:'jsone_core.php?do=moshakhasat&fetch=shomare_eghtesadi&contact_id='+contact_id ,
scriptTag: true ,
success: function(result,request){
Ext.getCmp('shomare_eghtesadi').setValue(result.responseText);
}
});

//shomare_sabt_melli
Ext.Ajax.request({
url:'jsone_core.php?do=moshakhasat&fetch=shomare_sabt_melli&contact_id='+contact_id ,
scriptTag: true ,
success: function(result,request){
Ext.getCmp('shomare_sabt_melli').setValue(result.responseText);
}
});
////reset address combo field
Ext.getCmp('combo_address').setValue('');
}

}
});

skirtle
23 Jun 2011, 4:52 PM
You should be able to use it in an editorgrid just like any other combobox. If you want to use it in a normal grid, rendering all cells in a column as comboboxes, then I think you'll have to hack it in by injecting the comboboxes after the grid is rendered.