gpt4 book ai didi

javascript - ExtJS Controller 问题。未捕获的类型错误 : Object [object Object] has no method 'setSortState'

转载 作者:行者123 更新时间:2023-11-29 17:19:01 25 4
gpt4 key购买 nike

T编写代码使用ExtJS4.0.1,MVC架构。当我开发主窗体时,我遇到了网站搜索扩展的问题。

当我试图在 Controller 中创建新的小部件时,我需要在子面板中呈现结果。所以当我编写示例代码时遇到以下问题:

**Uncaught TypeError: Object [object Object] has no method 'setSortState'**

我不明白为什么它会给出错误信息。我需要一些帮助来解决这个问题。

下面我想展示我的代码:

//Panel which is showing to user

Ext.define('Semantics.view.main.menuView', {
extend: 'Ext.panel.Panel',
layout: 'fit',
alias: 'widget.Menu',
title: "",
tbar: [
{
//search field
name:'mainSearchText',
id:'mainSearchText',
xtype: 'textfield',
defaultValue: 'Search',
height: 20
},
{
name:'mainSearchButton',
id:'mainSearchButton',
xtype: 'button',
text: 'Find',
height: 20
}
]
});


//controller for search request
Ext.define('Semantics.controller.main.mainController', {
extend: 'Ext.app.Controller',
views: ['main.menuView','mainSearch.MainSearchResultForm'],
refs: [
{ ref: 'menuPanel', selector: 'Menu' },
{ ref:'mainSearchText',selector:'#mainSearchText'},
{ref: 'mainSearchForm',selector:'#mainSearchForm'},
{ref:'MainSearchGrid',selector:'#MainSearchGrid'}
],

init: function () {
this.control({
'Menu': {
render: this.onPanelRendered
},
'Menu button[name="mainSearchButton"]': {
click: this.onButtonClick
}
});
},
onButtonClick: function (button) {
var me = this;
if(button.name=="mainSearchButton") {

var mtextFiled = me.getMainSearchText().getValue();

console.log(mtextFiled);
Ext.Ajax.request({
scope: this,
url: 'app/mainSearchT/findText/',
method: 'POST',
params: {
text: me.getMainSearchText().getValue()
},
success: function (result) {
mainPanel = me.getMenuPanel();
mainPanel.removeAll(true);
loadingMask = new Ext.LoadMask(mainPanel, { msg: "Loading" });
loadingMask.show();
var mname = 'MainSearchResultForm';
var start_info_panel = Ext.widget(mname);
mainPanel.items.add(start_info_panel);
loadingMask.hide();
mainPanel.doLayout(); //that line gives that error
},
failure: function (result) {
console.log(result);
}
});

}
},

onPanelRendered: function () {
}
});

最佳答案

我在 Ext.grid.Panel 列中包含不受支持的 xtype 时遇到了同样的错误。我不得不删除 xtype,这解决了问题。

关于javascript - ExtJS Controller 问题。未捕获的类型错误 : Object [object Object] has no method 'setSortState' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14233604/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com