码迷,mamicode.com
首页 > Web开发 > 详细

dhtmlx之dhtmlXGrid显示数据 --大数据

时间:2014-12-08 15:32:21      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:style   io   ar   color   os   sp   for   java   on   

引用

     <link href="../../dhtmlXGridScripts/dhtmlxgrid.css" rel="stylesheet" type="text/css" />
    <link href="../../dhtmlXGridScripts/dhtmlxgrid_skins.css" rel="stylesheet" type="text/css" />
    <script src="../../dhtmlXGridScripts/dhtmlxcommon.js" type="text/javascript"></script>
    <script src="../../dhtmlXGridScripts/dhtmlxgrid.js" type="text/javascript"></script>
    <script src="../../dhtmlXGridScripts/dhtmlxgridcell.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.4.4.js" type="text/javascript"></script>
   <script> window.dhx_globalImgPath = "../../dhtmlxComboScripts/imgs/"; </script>
    <script src="../../dhtmlXGridScripts/ext/dhtmlxgrid_srnd.js" type="text/javascript"></script>

 

 <div id="gridbox1" style=" height:100%; width:500px"></div>

 

 <script type="text/jscript">
        var mygrid; // 定义mygrid
        $(function () {
            mygrid = new dhtmlXGridObject(‘gridbox1‘);
            mygrid.setHeader("标题一,标题二,标题三"); // 设置grid的头
            mygrid.setInitWidths("150,150,150")
            mygrid.setColTypes("cntr,ro,ed");
            mygrid.setColAlign("center,center,center");
            mygrid.setColSorting("na,str,str");
            mygrid.setSkin("dhx_skyblue");
            mygrid.setColumnColor("#B0CDAF");
            mygrid.init(); // 初始化
            mygrid.enableSmartRendering(true); //加载大数据
            mygridjiazai(); // 调用方法,加载数据(数据库查询)
        });
        

        function mygridjiazai() {
            $.ajax({
                type: "POST",
                url: "/Main/GetDemoData",
                cache: false,
                success: function (result) {
                    mygrid.parse(result, "jsarray");
                }
            });
        }

</script>

 

public ActionResult GetDemoData()
        {
            ArrayList jsonList = new ArrayList();
            foreach (DataRow dr in Demo.DemoData().Rows)
            {
                jsonList.Add(new ArrayList() { dr["ID"], dr["Name"], dr["Content"] });
            }

           // string json = Demo.DataTable2Json(Demo.DemoData());
            return Json(jsonList, JsonRequestBehavior.AllowGet);
        }

dhtmlx之dhtmlXGrid显示数据 --大数据

标签:style   io   ar   color   os   sp   for   java   on   

原文地址:http://www.cnblogs.com/zh1989/p/4150980.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!