如何使EXT JS模型和代理存储工作?(please_help!



我不明白如何使用REST api链接服务器数据和表单字段。

我有一些选择字段的表单。我在服务器上有这个特别字段的值。我认为表单可以从存储模型(是/否?如果是真的,我有一个问题:如何将现有表单添加到模型中? 所以主要目标 - 从服务器获取值到现有 REST API 形式的存在选择字段。

这是我现在拥有的: -代理商店:

Ext.define('Foresto.store.RESTstore',{ 
extend: 'Ext.data.Store',
storeID:'reststore',
proxy: {
type:'rest',
url:'http://localhost:6666/api/form',
reader:{
type: 'json',
root: ''
}
},
autoLoad: true});

-一个来自表格:

Ext.define('Foresto.view.forms.Cutarea', {
extend: 'Ext.form.Panel',
title: 'ForestoL',
header: {
cls: 'header-cls',
},
scrollable: true,
xtype: 'forestoL',
url: 'save-form.php',
items: [{
xtype: 'selectfield',
label: 'Field1',
name: 'name'
},{
xtype: 'selectfield',
label: 'Field2',
name: 'allotment'
}] ...

拜托嘿嘿! 谢谢 阿图尔。

请参阅基本远程组合框的小提琴。

{
xtype: 'combo',
fieldLabel: 'My Combo',
valueField: 'id',
displayField: 'title',
anchor: '100%',
store: new Ext.data.Store({
autoLoad: true,
fields: ['id', 'title'],
proxy: {
type: 'ajax',
url: 'records.json'
}
})
}

最新更新