AutoTemp.txt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. 可通过修改数据库字段的注释 来配置字段控件属性。如:
  2. [fieldIgnore] 忽略当前字段
  3. [idField] 手动指定当前列为id列,默认为数据库主键
  4. [field:{path}=value] 直接把值设置到field中,path可以为多级路径,如:[field:title=登录名]
  5. [field:title=登录名] 字段的title为登录名,即标题显示登录名
  6. [field:visiable=false] 字段不可见
  7. [field:editable=false] 字段不可编辑
  8. [field:list_width=200] 列表页中此字段的宽度为200
  9. [field:field=name] 字段的field为name,同时为ig-id的值
  10. [field:ig-class=TextArea]字段的ig-class为 TextArea,不指定则为Text
  11. [field:ig-param={height:100,width:100}] ig-param的值,一般为对象
  12. 树形列表: 必须同时指定pid列和treeField列,否则作为普通列表数据展示
  13. [pidField] 当前列为pid
  14. [treeField] 列表页中当前列作为树形展示
  15. [rootPidValue:0] 树控件根节点的pid的值,默认为0,在任一列的注释中指定皆可
  16. 列表页数据筛选条件: 同一字段可指定多个筛选条件
  17. [filter:开始时间,=] 当前列作为筛选条件,筛选条件名称为开始时间(若不指定则为当前列title),筛选方式为"="
  18. [controller:path=value] 直接把值设置到controllerConfig中,path可以为多级路径,如:[controller:permit.delete=false]
  19. [controller:list.title=SqlText] 设置list页面标题为SqlText
  20. 设置不可删除(其他同理: insert、update、show、delete)
  21. [controller:permit.delete=false]
  22. 设置list页面rowButtons:
  23. [controller:list.rowButtons=[{text:'查看id',handler:'function(callback,id){ callback();alert(id); }' }]]
  24. field:
  25. { 'ig-class': 'TextArea', field: 'name', title: '<span title="装修商名称">装修商</span>', list_width: 200 ,visiable:false,editable:false }
  26. filter:
  27. { field: 'name', title: '装修商',filterOpt:'=' }
  28. 注释:
  29. 1.值中若出现中括号,可用以下转义。
  30. [ \x5B --- 左中括号
  31. ] \x5D --- 右中括号
  32. 2.xml转义符号
  33. < &lt;
  34. > &gt;
  35. & &amp;
  36. ' &apos;
  37. " &quot;
  38. 空格 &nbsp;
  39. demo:
  40. http://localhost:4570/autoTemp/Scripts/autoTemp/list.html?dataProvider=LocalStorageProvider
  41. http://localhost:4570/autoTemp/Scripts/autoTemp/list.html?dataProvider=LocalStorageProvider&tree=false
  42. var controllerConfig = {
  43. dependency: {
  44. css: [],
  45. js: []
  46. },
  47. /* 添加、修改、查看、删除 等权限,可不指定。 默认值均为true */
  48. '//permit': {
  49. insert: false,
  50. update: false,
  51. show: false,
  52. delete: false
  53. },
  54. idField: 'id',
  55. pidField: 'pid',
  56. //treeField: 'name',
  57. rootPidValue: '0',
  58. list: {
  59. title: 'autoTemp-demo',
  60. buttons: [
  61. { text: '执行js', handler: 'function(callback){ setTimeout(callback,5000); }' },
  62. //{ text: '调用接口', ajax: { type: 'GET', url: '/autoTemp/demo_list/getConfig' } }
  63. ],
  64. rowButtons: [
  65. { text: '查看id', handler: 'function(callback,id){ callback();alert(id); }' },
  66. //{ text: '调用接口', ajax: { type: 'GET', url: '/autoTemp/{template}/getConfig?name={id}' } }
  67. ]
  68. },
  69. fields: [
  70. { 'ig-class': 'Text', field: 'name', title: '<span title="装修商名称">装修商</span>', list_width: 200, editable: false },
  71. { 'ig-class': 'Text', field: 'sex', title: '性别', list_width: 80, visiable: false },
  72. { 'ig-class': 'TextArea', field: 'random', title: 'random', list_width: 150, 'ig-param': {height:300} },
  73. { 'ig-class': 'Text', field: 'random2', title: 'random2', list_width: 150 }
  74. ],
  75. filterFields: [
  76. { 'ig-class': 'Text', field: 'name', title: '装修商', filterOpt: 'Contains' },
  77. { 'ig-class': 'Text', field: 'sex', title: '性别' },
  78. { 'ig-class': 'Text', field: 'random', title: 'random' }
  79. ]
  80. };