ext.net 中需要在客户端把JSON字符串绑定到Store ,怎么弄
发布网友
发布时间:2022-05-17 05:16
我来回答
共2个回答
热心网友
时间:2023-10-09 04:08
1 var ds = new Ext.data.Store({
2 proxy: new Ext.data.ScriptTagProxy({
3 url: 'yoururl.json'
4 }),
5 reader: new Ext.data.JsonReader({
6 root: 'Fields',
7 totalProperty: 'totalCount',
8 id: 'id'
9 }, [
10 ,
11
12 ])
13 });
14 var combobox = new Ext.form.ComboBox({
15 id:'combobox',
16 x:0,
17 y:20,
18 store: da,
19 displayField:'field',
20 typeAhead: false,
21 loadingText: '正在加载字段...',
22 forceSelection: false,
23 triggerAction: 'all',
24 hideTrigger:false,
25 minChars:1,
26 anchor: '100%',
27 pageSize:10
28 });
json输出
注意stcCallback1007要用程序输出请求过来的参数callback的值
stcCallback1007(,,,,,,,,]});stcCallback1007(,,,,,,,,]});stcCallback1007(,,,,,,,,]});
不好意思,看错了,以下是grid的
// create the Data Store
var singleTablestore = new Ext.data.JsonStore({
root: 'topics',
totalProperty: 'totalCount',
idProperty: 'tableid',
remoteSort: true,
fields: [
,'name','description','importdate'
],
// load using script tags for cross domain, if the data in on the same domain as
proxy: new Ext.data.ScriptTagProxy({
url: 'abc.json'
})
});
singleTablestore.setDefaultSort('date', 'desc');
var singleTable = new Ext.grid.EditorGridPanel({
id:'singleTable-panel',
layout:'anchor',
anchor:['100%','100%'],
title:'单表数据处理',
store: singleTablestore,
//trackMouseOver:false,
//disableSelection:true,
loadMask: true,
autoScroll:true,
// grid columns
columns:[{
id: 'name',
header: "数据表名称",
dataIndex: 'name',
width: 200,
sortable: true,
renderer:renderTips
},{
id: 'description', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b )
header: "数据表描述",
dataIndex: 'description',
renderer:renderTips2,
editor:new Ext.form.TextField(),
width: 270,
// renderer: renderTopic,
sortable: true
},{
header: "导入日期",
dataIndex: 'importdate',
width: 150,
sortable: true
},{
id: 'tableid',
header: "操作",
dataIndex: 'tableid',
width: 450,
resizable: false,
//editor:new Ext.Button()
renderer: renderLast
//items:[new Ext.Button()]
}],
// customize view config
viewConfig: {
//forceFit:true,
enableRowBody:true,
//showPreview:true
},
// paging bar on the bottom
bbar: new Ext.PagingToolbar({
pageSize: 20,
store: singleTablestore,
displayInfo: true,
displayMsg: '当前显示 - 条,共 条',
beforePageText:'第',
afterPageText:'页,共页',
emptyMsg: "没有相应内容",
items:[
'-', {
pressed: true,
enableToggle:true,
text: 'Show Preview',
cls: 'x-btn-text-icon details',
toggleHandler: function(btn, pressed){
...
}
}]
})
});
singleTable.on('afteredit', afterEdit, this );
singleTable.on('show', function()});}, this );
function afterEdit(e) {
...
}
abc.json
stcCallback1009(,]});
热心网友
时间:2023-10-09 04:08
例如:
var store = new Ext.data.JsonStore({
url: 'planItemAction.do?method=listPlanItemPage',
fields: ['id', 'name', 'code', 'measureUnit', 'createUser', 'createDate', 'status'],
totalProperty: 'totalProperty',
root: 'results'
});