一个完整的idea spring boot 项目及坑---10.eazyui

第一次用springboot+eazyui.和springboot有些不一样.还是有不少坑.

记录一下:

1.springboot +eazyui 中如何使用datagrid(大坑)

datagrid和其他元素一样,也是可以通过<table>标签创建DataGrid控件,和通过javascript来创建.如图(来源:eazyui中文手册)


一个完整的idea spring boot 项目及坑---10.eazyui

但是!!!

在springboot中,使用Javascript去创建DataGrid控件时,运行时会报错!!我检查了2天的语法错误,发现语法没有任何错误.最后绝望之下试了试在<table>中创建,成功了....

注意:

datagrid中只有表格内容不能写在js中,其他的功能都可以写在js中:如

<table id="orderlist" class="easyui-datagrid"  border="false" >
    <thead>
    <tr>
        <th data-options="field:'ck',checkbox:true">全选</th>
        <th data-options="field:'orderid'">订单号</th>
        <th data-options="field:'name'">学校名称</th>
        <th data-options="field:'studentname'">学生姓名</th>
        <th data-options="field:'studentsession'">年级</th>
        <th data-options="field:'studentclass'">班级</th>
        <th data-options="field:'pname'">商品</th>
        <th data-options="field:'ptime'">支付时间</th>
        <th data-options="field:'pamount'">数量</th>
        <th data-options="field:'puprice'">单价</th>
        <th data-options="field:'price'">总价</th>
        <th data-options="field:'state'">状态</th>
        <th data-options="field:'para'">商品规格</th>
        <th data-options="field:'username'">手机号</th>
        <th data-options="field:'remark'">商家留言</th>
        <th data-options="field:'message'">顾客留言</th>
    </tr>
    </thead>
</table>
其他的什么分页/工具栏/各种方法.都可以写到js中..

2.使用tips

1.点击获取datagrid中任意行的任意值

//选择一行
//datagrtid事件,点击行时触发 onClickRow:function(){
//获得这一行所有属性   
var raw = $("#orderlist").datagrid("getSelected");
    console.log(raw);
//获得指定的属性值
 orderiddate = raw.orderid;