簡體   English   中英

如何使 EXT JS 模型和代理存儲工作? (請幫忙!)

[英]How to make EXT JS model and proxy store work? (please_help!)

我還沒有理解如何使用 REST api 鏈接服務器數據和表單的字段。

我有一些選擇字段的表格。 我在服務器上有這個特別字段的值。 我認為表單可以從商店模型中獲取數據(是/否?)。 如果是真的,我有一個問題:如何將現有表單添加到模型中? 所以主要目標 - 從服務器獲取值到存在形式 trought 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'
        }
    })
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM