顯示具有 T1 標籤的文章。 顯示所有文章
顯示具有 T1 標籤的文章。 顯示所有文章

2022年7月19日 星期二

store , json , 主機取得資料 以 JSON 格式傳回前端

 var store1 = Ext.create('Ext.data.Store', {

        id: 'store1',

        pageSize: 10,

        fields: par_Fields,

        autoLoad: true,

        proxy: {

            type: 'ajax',

            url: '../api/myAPI/SQLOPEN',

            extraParams: np,

            getMethod: function () { return 'POST'; },            

            async: false,

            reader: {                      // reader: The Ext.data.reader.Reader to use to decode the server's response or data read from client. 

                type: 'json',            //The JSON Reader is used by a Proxy to read a server response that is sent back in JSON format

  root: 'T1',              //The name of the property which contains the data items corresponding to the Model(s) for which this Reader is configured. For JSON reader it's a property name (or a dot-separated list of property names if the root is nested).

               totalProperty: 'T1C[0].TOTAL'   //Name of the property from which to retrieve the total number of records in the dataset.

//T1C必需有 TOTAL 欄位   

            }

            }

        }

    })