extjs中store获取后台数据_Extjs的combobox使用jsonstore获取asp.net后台数据

当前位置:我的异常网» Ajax » Extjs的combobox使用jsonstore获取asp.net后台数据

Extjs的combobox使用jsonstore获取asp.net后台数据

www.myexceptions.net  网友分享于:2013-04-07  浏览:282次

Extjs的combobox使用jsonstore获取asp.net后台数据 - Web 开发 / Ajax

js源码

更多Extjs表单项

Ext.onReady(function() {

Ext.BLANK_IMAGE_URL = "Resources/Images/default/s.gif";

/*

var dstore = new Ext.data.JsonStore({

url: "getDepartment.aspx",

fields: ["Name", "Code"],

root: 'rows'

});

dstore.load();

var dateSelect = new Ext.form.FormPanel({

title: "日期选择",

labelSeparator: ':',

labelWidth: 60,

labelAlign: "right",

width: 600,

applyTo: 'dateSelect',

items: [

new Ext.form.DateField({

id: 'dfSelect',

format: 'Y年m月d日',

minValue: '1900-01-01',

maxValue: '3000-01-01',

disabledDaysText: '禁止选择该日期',

fieldLabel: '选择日期',

width: 150,

showToday: true

}),

new Ext.form.ComboBox({

id: "cbDepartment",

fieldLabel: "部门",

triggerAction: "all",

store: dstore,

valueField: "Code",

displayField: "Name",

mode: "local",

forceSection: true,

typeAhead: true,

resizeAble: true

}),

new Ext.form.HtmlEditor({

id: 'htmlContent',

width: 500,

autoHeight: false,

fieldLabel: "HTML编辑"

})

]

});

Ext.MessageBox.alert("Test the return record num", "共获得" + dstore.getCount() + "条数据");

});

asp.net页面源码

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace Web

{

public partial class getDepartment : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

string result = null;

result = "{rows:[{'Name':'开发部', 'Code':'1'}, {'Name':'销售部', 'Code':'2'}, {'Name':'行政部', 'Code':'3'}, {'Name':'质检部', 'Code':'4'}]}";

HttpContext.Current.Response.ContentType = "text/plain";

HttpContext.Current.Response.Write(result);

// Response.Write(result);

}

}

}

下拉框得不到数据,请问这段代码哪里有错误?

------解决方案--------------------

代码应该没有问题 确定store里面有数据吗?

加这句试试看有没有数据返回

dstore.load({callback:function(){

alert("Test the return record num", "共获得" + dstore.getCount() + "条数据");

}});

文章评论


版权声明:本文为weixin_30232751原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。