首先先来看一下,直接从后台读取数据并展示到前端的列表,后端传回的数据是“按商品ID倒序排列”

easyUI 之datagrid    在前端自定义排序

前端源代码

 1    $('#good_tables').datagrid({
 2         nowrap: true,
 3         autoRowHeight: true,
 4         striped: true,
 5         fitColumns: true,
 6         collapsible: true,
 7         url: 'xxx',
 8         border: false,
 9         idField: 'id',
10         selectOnCheck: true,
11         singleSelect: true,
12         width:'100%' ,
13         resizable:true,
14         columns: [[
15             {
16                 field: 'id',
17                 title: '商品ID',
18                 width: 60,
19                 align: 'center',
20                 formatter: function (value) {
21                     return value+"";
22                 }
23             },
24             {
25                 field: 'goodsName',
26                 title: '商品名称',
27                 width: 120,
28                 align: 'center',
29                 formatter: function (value) {
30                     return value;
31                 }
32             },
33             {
34                 field: 'activity_do',
35                 title: '操作',
36                 width: '15%',
37                 align: 'center',
38                 formatter: function (value, row) {
39                     return'<a href="javascript:delGoods(' + row.id +')" style="color: red">删除</a>';
40                 }
41             }
42         ]],
43         pagination: true,
44         pageSize: 10,
45         rowNumbers: false
46     });
修改前的代码

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2021-05-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案