如何正确加载带有动态数据存储的gridcombobox?
我正在开发一个简单的网格表单,它有一个组合框和数据源作为代理(例如 http://goo.gl/2fxP8)。组合框加载正确,但当我尝试选择列表项之一时,网格窗体关闭,而组合框未关闭。有人能帮我吗?
我还计划扩展组合框 onselect 函数,以便一旦选择列表项,其他字段将被动态加载。
searchField = new Ext.form.ComboBox({
store: ds,
name : 'search',
id:'search',
fieldLabel : 'Search',
displayField:'title',
typeAhead: false,
loadingText: 'Searching...',
pageSize:10,
minChars:2,
triggerAction: 'all',
width: 200,
tpl: resTpl,
itemSelector: 'div.search-item',
onSelect: function(record){
/* Set Values to other fields here */
}
}),
保存的代码是:
Ext.Ajax.request
({
url:"some url",
scope:this,
params:
{
},
success: function(objServerResponse)
{
eval("var resultSet = " +objServerResponse.responseText);
if(resultSet.isOk)
{
this.collapse();
}
else
{
}
}
});
I am working on a simple grid form which has a combobox and datasource as proxy (like http://goo.gl/2fxP8). The combobox loads properly but when I try to select one of the list items the gridform closes and combobox doesn't close. Can anyone help me out ?
I am planning to extend the combobox onselect function as well so that once the list item is chosen other fields will be loaded dynamically.
searchField = new Ext.form.ComboBox({
store: ds,
name : 'search',
id:'search',
fieldLabel : 'Search',
displayField:'title',
typeAhead: false,
loadingText: 'Searching...',
pageSize:10,
minChars:2,
triggerAction: 'all',
width: 200,
tpl: resTpl,
itemSelector: 'div.search-item',
onSelect: function(record){
/* Set Values to other fields here */
}
}),
The code for saving is :
Ext.Ajax.request
({
url:"some url",
scope:this,
params:
{
},
success: function(objServerResponse)
{
eval("var resultSet = " +objServerResponse.responseText);
if(resultSet.isOk)
{
this.collapse();
}
else
{
}
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题是你覆盖了
onSelect
函数..看看这里(尝试找到
onSelect
),onSelect
方法是私有的...正如您所看到的,在
onSelect
内部有一个默认调用的collapse
函数。所以,如果你超过了
onSelect
..默认情况下你的组合永远不会折叠..你必须手动执行此操作...就像 kiran 所说的...
我的问题是,为什么你要覆盖
onSelect
函数??..如果您需要做某事,当选择组合时,为什么不将其设置为侦听器?
尝试更改您的代码:
使用以下代码:
i think the problem is you are OVERIDE the
onSelect
function..take look here (try to find
onSelect
),onSelect
method is private...and as you can see, inside
onSelect
there iscollapse
function to call by default..so, if you are overide
onSelect
.. your combo never collapse by default..you have to do that manually.. like what kiran said...
and my question is, why did you overide the
onSelect
function ??..if you need to do something When the combo was selected, why don't you set it as listeners ??
try change your code :
with this one :