【发布时间】:2018-10-25 08:46:13
【问题描述】:
我还没有理解如何使用 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'
}] ...
请帮忙! 谢谢, 阿图尔。
【问题讨论】:
标签: javascript extjs sencha-touch sencha-touch-2 extjs4.1