Code:
new Ext.form.FormPanel({
frame: true,
title: 'Web sites',
style: 'padding-top: 10px',
defaults: { bodyStyle:'padding:2px', labelStyle: 'width:150px;font-weight: bold;margin-right: 5px;font-size:90%;' },
labelAlign: 'right',
items: [
{
xtype: 'xlovfield',
fieldLabel: 'Web sites',
id: 'websites',
name: 'websites',
allowBlank: true,
multiSelect: true,
lovTitle : 'Select Web sites',
lovHeight : 250,
lovWidth : 500,
width: fieldWidth,
minItem : 0,
valueField: 'id',
displayField: 'text',
displayValue: 'Toto', // I load both data from a jsp
hiddenValue: '18', // I didn't yet try to set these values from js, but I will have a look
textarea : true,
showOnFocus : true,
view : new Ext.grid.GridPanel({
id: 'websites-grid',
store: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: PATH_WEB_APPLICATION+'/websites.xml'}),
reader: new Ext.data.XmlReader({
record: 'website',
id: 'id',
fields: [
{name: 'id', type: 'string'},
{name: 'text', type: 'string'},
{name: 'url', type: 'string'}
]
})
}), cm: new Ext.grid.ColumnModel([
new Ext.grid.CheckboxSelectionModel(),
{id: 'id', header: 'Identifier', hidden: true, dataIndex: 'id'},
{header: 'Website', autoWidth: true, dataIndex: 'text'},
{header: 'URL', autoWidth: true, dataIndex: 'url'}
]), sm: new Ext.grid.CheckboxSelectionModel({
singleSelect:false,
listeners:{
beforerowselect: function(sm, row_index, keepExisting, record){
sm.suspendEvents();
if (sm.isSelected(row_index))
sm.deselectRow(row_index);
else
sm.selectRow(row_index, true);
sm.resumeEvents();
return false;
}
}
}), border: true,
viewConfig: { forceFit:true },
stripeRows: true
})
}
]
})
PS: I've managed to link this field data to a combobox (I select a company in a combobox and then its contacts in this field). If you need I can provide you a sample, but I don't managed to init this field from a
... if someboy has an idea... it can be usefull !!!