ext grid 分页 数据不显示
编程技术  /  houtizong 发布于 3年前   126
<html><link rel="stylesheet" type="text/css" href="/ad/publisher/js/ext2/resources/css/ext-all.css" /><script type="text/javascript" src="/ad/publisher/js/ext2/adapter/ext/ext-base.js"></script><script type="text/javascript" src="/ad/publisher/js/ext2/ext-all.js"></script><script type="text/javascript" src="/ad/publisher/js/ext2/examples/examples.js"></script><link rel="stylesheet" type="text/css" href="/ad/publisher/js/ext2/examples/grid/grid-examples.css" /><script>Ext.onReady(function(){ var sm = new Ext.grid.CheckboxSelectionModel(); var cm = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), sm, {header:"编号",dataIndex:"id"}, {header:"名称",dataIndex:"name"}, {header:"描述",dataIndex:"descn"} ]); cm.defaultSortable = true; var ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:"/ad/admin/module/admanage/hotspot/date.php"}),reader: new Ext.data.JsonReader({ totalProperty: "totalProperty", root: "root" }, [ {name: "id"}, {name: "name"}, {name: "descn"} ]) }); var grid = new Ext.grid.GridPanel({ el: "grid3", ds: ds, cm: cm, sm: sm, title: "ASP->JSON", bbar: new Ext.PagingToolbar({ pageSize: 10, store: ds, displayInfo: true, displayMsg: "显示第 {0} 条到 {1} 条记录,一共 {2} 条", emptyMsg: "没有记录" }), tbar: new Ext.PagingToolbar({ pageSize: 10, store: ds, displayInfo: true, displayMsg: "显示第 {0} 条到 {1} 条记录,一共 {2} 条", emptyMsg: "没有记录" }), height:500, width:860 //autoHeight: true//一定要写,否则显示的数据会少一行 }); ds.load({params:{start:0,limit:10}}); grid.render();});</script><div id="grid3"></div></html>
<?$start= $vars["start"];$limit = $vars["limit"]; $db = new ps_DB; $db->connect(); $hot = new Hot(null,$db); $rs = $hot->LoadList($start,$limit); $db->close(); $cu = 200; $cou = count($rs);?>{totalProperty:<?=$cu?>,root:[<? foreach($rs as $num=>$obj) { $name = iconv("gb2312", "UTF-8", $obj->name);?>{'id':'<?=$obj->id?>','name':'<?=$name?>','descn':descn'<?=$obj->id?>'}<? if($num+1 != $cou) { ?>,<? } } ?>]}
{totalProperty:200,root:[{'id':'224','name':'224','descn':descn'224'},{'id':'10','name':'10','descn':descn'10'},{'id':'55','name':'55','descn':descn'55'},{'id':'90','name':'90','descn':descn'90'},{'id':'112','name':'112','descn':descn'112'},{'id':'206','name':'206','descn':descn'206'},{'id':'207','name':'207','descn':descn'207'},{'id':'208','name':'208','descn':descn'208'},{'id':'209','name':'209','descn':descn'209'},{'id':'210','name':'210','descn':descn'210'}]}
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接