数据绑定示例 extjs sencha
Data binding example extjs sencha
我有一个网格示例,我想让它看起来像下面的这个网址
http://docs.sencha.com/extjs/4.2.2/#!/example/grid/binding.html
网格代码为:
var grid_modal = Ext.create('Ext.grid.Panel',
{
width: '100%',
height: 450,
frame: true,
loadMask: true,
collapsible: false,
title: 'Detail data',
store: list_data,
columns: [
{
header: 'Number',
width: 130,
sortable: true,
dataIndex: 'doc_no',
xtype: 'templatecolumn',
tpl: '{doc_no}<br/>{pp_id}'
}, {
header: 'Date.',
width: 100,
sortable: true,
dataIndex: 'pp_date',
xtype: 'datecolumn',
format:'d-m-Y'
}, {
header: 'Vendor',
width: 160,
sortable: true,
dataIndex: 'org_order',
xtype: 'templatecolumn',
tpl: '{org_order}'
}],
dockedItems:
[{
xtype: 'pagingtoolbar',
store: list_data,
dock: 'bottom',
displayInfo: true
},{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
cls: 'contactBtn',
scale: 'small',
text: 'Add',
handler: function(){
window.location = './pp/detail/'
}
},'->','Periode :',
set_startdate('sdatepp',start),
's.d',
set_enddate('edatepp',end),
'-',
{
xtype : 'textfield',
name : 'find_pp',
id : 'find_pp',
emptyText: 'Keywords' ,
listeners: {
specialkey: function(field, e){
if (e.getKey() == e.ENTER) {
onFindPP('find_pp','sdatepp','edatepp')
}
}
}
}]
}],
});
我不明白如何将数据绑定添加到我制作的下方网格。 所以它看起来像 extjs 文档上的示例。 请帮助我了解如何使数据网格绑定。 感谢您的关注和帮助。
public ActionResult ExPage()
{
return View();
}
public JsonResult GetData()
{
return Json(db.Products.ToList().Select(x => new Products { ProductID = x.ProductID, ProductName = x.ProductName, UnitPrice = x.UnitPrice, UnitsInStock = x.UnitsInStock }), JsonRequestBehavior.AllowGet);
}
<script type="text/javascript">
Ext.onReady(function () {
var store = Ext.create('Ext.data.Store', {
autoLoad: true,
fields: ['ProductID', 'ProductName', 'UnitPrice', 'UnitsInStock'],
proxy: {
type: 'ajax',
url: '/Home/GetData'
}
});
var grid = Ext.create('Ext.grid.Panel', {
store: store,
title: 'Products',
columns:
[
{ text: 'Id', dataIndex: 'ProductID', width: 50 },
{ text: 'Name', dataIndex: 'ProductName', width: 200 },
{ text: 'Price', dataIndex: 'UnitPrice', width: 80 },
{ text: 'Stock', dataIndex: 'UnitsInStock', width: 60 }
],
width: 450,
renderTo: Ext.getBody()
});
});
相关文章:
- 如何在Sencha ExtJS图表中反转轴
- 我可以使用sencha extjs商店和模型进行sencha触摸吗
- Sencha ExtJS store.nextPage() 然后 store.first() 给出前一页的第一条记录
- Sencha ExtJs 为什么从“构造函数”方法返回“this”
- Sencha extjs 属性范围
- Sencha extjs 5在West布局中显示树
- Sencha ExtJS 4.2:如何在一个网格中同步两个组合编辑器
- FireFox中的Sencha ExtJs TextField KeyDown事件
- Sencha ExtJS将HTML控件附加到应用程序
- Sencha/ExtJS-记录[x].set()未保存/设置
- 如何在sencha-extjs窗口中获取iframe
- Sencha ExtJS 4链接的组合框问题
- Sencha extjs 5一个文件项目不是MVC
- 在Sencha ExtJs 6.0中制作树视图
- 在mousedown - Sencha ExtJs中存储变量的问题
- Sencha ExtJS msg alert不会消失
- Sencha ExtJs视图选择模式
- Sencha ExtJS propertyeeditor网格单元格颜色
- Sencha-Extjs-如何从控制器动态使用网格getRowClass()
- Sencha extjs 4.1-可以在config中定义模型字段吗