时间:2021-05-28
普通情况下,treegrid的图标是默认的文件夹与文件的形式,如下图:
我们可以在json文本中加入iconCls来改变默认图标,例如样例中:
{"total":7,"rows":[{"id":1,"name":"All Tasks","begin":"3/4/2010","end":"3/20/2010","progress":60,"iconCls":"icon-ok"},{"id":2,"name":"Designing","begin":"3/4/2010","end":"3/10/2010","progress":100,"_parentId":1,"state":"closed"},{"id":21,"name":"Database","persons":2,"begin":"3/4/2010","end":"3/6/2010","progress":100,"_parentId":2},{"id":22,"name":"UML","persons":1,"begin":"3/7/2010","end":"3/8/2010","progress":100,"_parentId":2},{"id":23,"name":"Export Document","persons":1,"begin":"3/9/2010","end":"3/10/2010","progress":100,"_parentId":2},{"id":3,"name":"Coding","persons":2,"begin":"3/11/2010","end":"3/18/2010","progress":80},{"id":4,"name":"Testing","persons":1,"begin":"3/19/2010","end":"3/20/2010","progress":20}],"footer":[{"name":"Total Persons:","persons":7,"iconCls":"icon-sum"}]}然后修改icon.css以及将要用到的图标放在指定的文件夹。
通常情况下,讲过这样的修改,treegrid就可以显示出你自己设计的图标了。
如果此时还不能显示出你设定的图标,可以查看一下页面中引入icon.css以及easyui.css的顺序,要保证easyui.css在前,icon.css在后。否则,easyui.css中的样式就会将icon.css覆盖点,依旧显示默认图标。
下面给大家介绍jQuery EasyUI treegrid 增删改查代码
<script type="text/javascript">function formatProgress(value){if (value){var s = '<div style="width:100%;border:1px solid #ccc">' +'<div style="width:' + value + '%;background:#cc0000;color:#fff">' + value + '%' + '</div>''</div>';return s;} else {return '';}}var editingId;function deleteRow(){if (editingId != undefined){$('#tg').treegrid('select', editingId);return;}var row = $('#tg').treegrid('getSelected');if (row){editingId = row.id$('#tg').treegrid('remove', editingId);$('#tg').treegrid('reloadFooter');}$(".actionbtn").toggleClass("l-btn-disabled");}function edit(){if (editingId != undefined){$('#tg').treegrid('select', editingId);return;}var row = $('#tg').treegrid('getSelected');if (row){editingId = row.id$('#tg').treegrid('beginEdit', editingId);}$(".actionbtn").toggleClass("l-btn-disabled");}function insert(){if (editingId != undefined){$('#tg').treegrid('select', editingId);return;}var rows = $('#tg').treegrid('getChildren');editingId = rows.length+1;var row = null;var _data = {"id":editingId,"name":"new name","persons":0,"begin":"3/19/2010","end":"3/20/2010","progress":10};var _parentId = 0;var row = $('#tg').treegrid('getSelected');if (row){$('#tg').treegrid('expand',row.id);_parentId = row.id;}else{var root = $('#tg').treegrid('getRoot');_parentId = null;}$('#tg').treegrid('append',{parent: _parentId, // 这里指定父级标识就可以了data: [_data]});$('#tg').treegrid('beginEdit',_data.id);$(".actionbtn").toggleClass("l-btn-disabled");}function save(){if (editingId != undefined){var t = $('#tg');t.treegrid('endEdit', editingId);editingId = undefined;var persons = 0;var rows = t.treegrid('getChildren');for(var i=0; i<rows.length; i++){var p = parseInt(rows[i].persons);if (!isNaN(p)){persons += p;}}var frow = t.treegrid('getFooterRows')[0];frow.persons = persons;t.treegrid('reloadFooter');$(".actionbtn").toggleClass("l-btn-disabled");}}function cancel(){if (editingId != undefined){$('#tg').treegrid('cancelEdit', editingId);editingId = undefined;}$(".actionbtn").toggleClass("l-btn-disabled");}</script><div style="margin:10px 0;"><a href="javascript:void(0)" disabled="disabled" class="easyui-linkbutton actionbtn" onclick="save()">Save</a><a href="javascript:void(0)" disabled="disabled" class="easyui-linkbutton actionbtn" onclick="cancel()">Cancel</a></div>声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
最近需要实现对treeGrid的查询功能,具体查询界面如下:可以查询根节点和具体子节点的信息,开始使用EasyUI的TreeGrid的loadData加载url
目的:生成树形结构的表格数据(EasyUI也有TreeGrid,此处只是提供一个思路),可以扩展单击展开/收缩节点图例:类代码:复制代码代码如下:usingSy
xp让所有用户桌面显示系统默认图标的方法注册表:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVe
iOS6),用户已经可以改变苹果AppleTV主屏幕上图标的位置,不过第一排和第二排图标的位置仍然不能改变。 注意:在进行以下操作之前先确认你的AppleTV
写在最前面这个星期一直在纠结easyui的treegrid的过滤功能,原因呢,自然是项目中一个莫名奇妙的需求。easyui虽说是后端程序员的前端框架,但是说句实