| [Grid] ???2014-03-11 13:16:17by ??? grid可以对查询到的数据进行排序。 列排序分为 (1)客户端排序 (2)服务端排序 客户端排序指在浏览器端通过脚本来实现数据排序,不涉及到服务端的查询。因此适合没有分页的表格 (1) 在dataset上指定排序类型sortType="local" 如果不指定默认是remote服务端排序 (2) 在需要排序的列上指定属性sortable="true" <a:dataSets> <a:dataSet id="demo_ds" sortType="local"> <a:fields> <a:field name="amount" datatype="int"/> </a:fields> <a:datas> <a:record product="产品A" amount="100" a="a" b="b" c="c"/> <a:record product="产品B" amount="300" a="a" b="b" c="c"/> <a:record product="产品C" amount="2000" a="a" b="b" c="c"/> <a:record product="产品D" amount="950" a="a" b="b" c="c"/> <a:record product="产品E" amount="200" a="a" b="b" c="c"/> </a:datas> </a:dataSet> </a:dataSets> <a:grid bindTarget="demo_ds" height="300" navBar="false" style="border:none" width="900"> <a:columns> <a:column name="product" prompt="a" width="250"/> <a:column name="amount" prompt="可排序列" sortable="true" width="250"/> <a:column name="a" prompt="b" width="100"/> <a:column name="b" prompt="c" width="100"/> <a:column name="c" prompt="d" width="100"/> </a:columns> </a:grid> 服务端排序通常需要向服务端重新发起查询请求,通过服务端的sql来实现排序功能。默认只需要在列上指定sortable="true"即可 <a:grid bindTarget="demo_ds2" height="300" navBar="true" style="border:none" width="900"> <a:columns> <a:column name="service_name" prompt="页面名(排序列)" sortable="true" width="250"/> <a:column name="title" prompt="页面标题" width="250"/> <a:column name="is_access_checked" prompt="是否权限控制" width="100"/> <a:column name="is_login_required" prompt="是否登录" width="100"/> <a:column name="is_system_access" prompt="是否系统页面" width="100"/> </a:columns> </a:grid> Demo Attachments |
Comments
0 Responses to the article暂时没有评论。