easyui DataGrid控件 dome中cellediting

发布于 2022-09-04 17:33:54 字数 4408 浏览 21 评论 0

这是不能运行的代码

<table id="dg" title="Cell Editing in DataGrid" style="width:700px;height:auto"
            data-options="
                iconCls: 'icon-edit',
                singleSelect: true,
                url: 'http://47.91.104.69/SysSample/GetList',
                method:'post'
            ">
        <thead>
            <tr>
                <th data-options="field:'Id',width:80">Item ID</th>
                <th data-options="field:'Name',width:100,editor:'text'">Product</th>
                <th data-options="field:'Age',width:80,align:'right'">List Price</th>
                <th data-options="field:'Bir',width:80,align:'right',editor:'numberbox'">Unit Cost</th>
                <th data-options="field:'Photo',width:250,editor:'text'">Attribute</th>
                <th data-options="field:'Note',width:60,align:'center'">Status</th>
            </tr>
        </thead>
    </table>请输入代码

把url 'http://47.91.104.69/SysSample...'中的数据直接保存为'datagrid_data1.json'引用 却可以显示

以下为数据

{"rows":[{"Id":"201602171807278882367a9fec6b296","Name":"黄叔兰","Age":56,"Bir":"1973-03-06 00:00:00","Photo":"/upload/201602/17/201602171807261174.jpg","Note":"习惯着彼此的语言,重复万遍也不觉厌倦;等待着彼此的晚安,只因为心里那份惦念","CreateTime":"2016-02-17 18:07:27"},{"Id":"201602171724514198277f991672641","Name":"史定","Age":45,"Bir":"1974-02-17 00:00:00","Photo":"/upload/201602/17/201602171724492152.jpg","Note":"趁着年轻,大胆地走出去,去迎接风霜雨雪的洗礼,","CreateTime":"2016-02-17 17:24:51"},{"Id":"2016021717223448157003617c162eb","Name":"谭欲志","Age":1,"Bir":"2016-02-17 00:00:00","Photo":"/upload/201602/17/201602171722310201.jpg","Note":"若有若无的联系,是一份随意;或深或浅的交集,是一份默契。","CreateTime":"2016-02-17 17:22:34"},{"Id":"201602171721306879600b164533bc5","Name":"尤永驰","Age":55,"Bir":"1977-02-17 00:00:00","Photo":"/upload/201602/17/201602171721270673.jpg","Note":" 走千条路,只一条适合;遇万般人,得一人足够。","CreateTime":"2016-02-17 17:21:30"},{"Id":"2016021717204177978350b003b16bf","Name":"申晶冰","Age":4,"Bir":"2012-10-11 00:00:00","Photo":"/upload/201602/17/201602171720342176.jpg","Note":"可肆意畅谈,也可默然相对;可紧密相连,也可疏于不见。","CreateTime":"2016-02-17 17:20:41"},{"Id":"20160217171937012416538b73f0579","Name":"范建","Age":16,"Bir":"2000-02-17 00:00:00","Photo":"/upload/201602/17/201602171719348839.jpg","Note":" 人生是很苦的,你现在不苦,以后就会更苦。","CreateTime":"2016-02-17 17:19:37"},{"Id":"201602171714419157058054e82c543","Name":"郑再镐","Age":23,"Bir":"1993-11-18 00:00:00","Photo":"/upload/201602/17/201602171714408479.jpg","Note":" 心若相知,无言也默契;情若相眷,不语也怜惜。","CreateTime":"2016-02-17 17:14:41"},{"Id":"20160217171401199924874f2d87409","Name":"朱嫦粉","Age":26,"Bir":"2016-08-03 00:00:00","Photo":"/upload/201602/17/201602171713583047.jpg","Note":" 有一种陪伴虽不见身影,却很真诚;有一种守候虽悄然无声,却很深情。","CreateTime":"2016-02-17 17:14:01"},{"Id":"201602171713197077582c051f64183","Name":"姬从良","Age":45,"Bir":"1983-04-07 00:00:00","Photo":"/upload/201602/17/201602171712585444.jpg","Note":" 人生是很累的,你现在不累,以后就会更累。","CreateTime":"2016-02-17 17:13:19"},{"Id":"2016021716321673194107c1e289782","Name":"史珍香","Age":36,"Bir":"2016-02-18 00:00:00","Photo":"/upload/201602/17/201602171710398148.jpg","Note":"十年前你是谁,一年前你是谁,甚至昨天你是谁,都不重要。重要的是,今天你是谁?","CreateTime":"2016-02-17 16:32:16"}],"total":10}

这是可以用行的代码

    <table id="dg" title="Cell Editing in DataGrid" style="width:700px;height:auto"
            data-options="
                iconCls: 'icon-edit',
                singleSelect: true,
                url: 'datagrid_data1.json',
                method:'post'
            ">
        <thead>
            <tr>
                <th data-options="field:'Id',width:80">Item ID</th>
                <th data-options="field:'Name',width:100,editor:'text'">Product</th>
                <th data-options="field:'Age',width:80,align:'right'">List Price</th>
                <th data-options="field:'Bir',width:80,align:'right',editor:'numberbox'">Unit Cost</th>
                <th data-options="field:'Photo',width:250,editor:'text'">Attribute</th>
                <th data-options="field:'Note',width:60,align:'center'">Status</th>
            </tr>
        </thead>
    </table>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文