我在 Ext.ux.form 中使用 ItemSelector。我需要用一些默认值填充 Selected 列。我可以正确填充可用列,但是当我尝试将 toField 的存储设置为默认值时,它最终会出现在可用列中。以下是代码片段。有人可以帮我吗?
var data = [{"name":"abcd"}];
var ds = SailPoint.Store.createStore({
url: CONTEXT_PATH + '/define/applications/discoverServers.json',
fields: ['name','value'],
autoLoad: true,
baseParams: {domain : domain},
listeners: {
load: function() {
alert('store loaded');
}
}
});
var itemselectorField = new Ext.Panel({
title: 'Select Servers',
width: 700,
id:'selectServerId',
bodyPadding: 10,
height: 300,
renderTo: 'itemselector',
layout: 'fit',
items:[{
xtype: 'itemselector',
name: 'itemselector',
id: 'itemselectorField',
anchor: '100%',
imagePath: '../images/extjs-ux/',
store: ds,
displayField: 'name',
valueField: 'name',
allowBlank: false,
msgTarget: 'side',
fromTitle: 'Available',
toTitle: 'Selected',
listeners: {
afterrender: function() {
Ext.getCmp('itemselectorField').toField.store.loadData(data);
Ext.getCmp('selectServerId').doLayout();
alert("After Render");
}
}
}
]
});