我是ExtJS的新手。我看到一个例子并将其复制到空白页面上。当我运行此页面时出现错误:
TypeError:Ext.state未定义
Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));
这是我正在尝试的完整代码:
<登记/>
&lt;!DOCTYPE html PUBLIC“ - // W3C // DTD XHTML 1.0 Transitional // EN”“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ExtJS CRUD</title>
<link href="extjs/resources/ext-theme-neptune/ext-theme-neptune-all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="extjs/ext-debug.js"></script>
</head>
<body>
<script language="javascript" type="text/javascript">
Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose',
store: [[1, "Harpo"], [2, "Chico"], [3, "Groucho"]],
displayField: 'name',
typeAhead: true,
forceSelection: true,
valueField: 'abbr',
renderTo: Ext.getBody(),
stateful: true,
stateId: 'myIdentifierUniqueAmongAllMyStatefulComponentsUsedToStoreAndFetchMyState',
stateEvents: ['select'],
getState: function (me) {
// On any of the stateEvents, the framework runs this.
// "Hey component, what do you want me to remember for you?
return {
value: this.getValue()
};
},
applyState: function (state) {
// On component initialization, the framework runs this.
// "Hey component, here's that object I saved for you
this.setValue(state.value);
}
});
</script>
</body>
</html>
我错过了什么?
答案 0 :(得分:0)
你需要它:
Ext.require('Ext.state.*');