easyui 樹形表格初始化不展示子節點與更改圖示
阿新 • • 發佈:2018-12-24
一. 不展示子節點
效果圖
這個只要在你返回給前臺的資料型別中加一個欄位就好:state:“closed”
假如下面是你返回的資料型別:
{"total":9,"rows":[ {"id":1,"region":"Wyoming"}, {"id":11,"region":"Albin","_parentId":1}, {"id":12,"region":"Canon","_parentId":1}, {"id":13,"region":"Egbert","_parentId":1}, {"id":2,"region":"Washington"}, {"id":21,"region":"Bellingham","_parentId":2}, {"id":22,"region":"Chehalis","_parentId":2}, {"id":23,"region":"Ellensburg","_parentId":2}, {"id":24,"region":"Monroe","_parentId":2} ]}
你只要給的父節點加一個state:“closed”`就好,如:
{"total":9,"rows":[ {"id":1,"region":"Wyoming","state":"closed"}, {"id":11,"region":"Albin","_parentId":1}, {"id":12,"region":"Canon","_parentId":1}, {"id":13,"region":"Egbert","_parentId":1}, {"id":2,"region":"Washington","state":"closed"}, {"id":21,"region":"Bellingham","_parentId":2}, {"id":22,"region":"Chehalis","_parentId":2}, {"id":23,"region":"Ellensburg","_parentId":2}, {"id":24,"region":"Monroe","_parentId":2} ]}
效果圖:
二.更改樹形表格預設圖示
其實這個和讓表格初始化不展示子節點是一樣的,要在返回的型別中加上欄位:“iconCls”:“icon-add”:
效果圖:
請注意·:這個"con-add"是預設可以選擇的,由自己定義