ui-grid 常用操作
来源:互联网 发布:天津日报大厦知乎 编辑:程序博客网 时间:2024/06/05 11:06
这是一个表格控件,官网地址为: http://ui-grid.info/docs/#/tutorial
html:
<div class="panel-body"><div ui-grid="gridOptions" ui-grid-selection ui-grid-pagination ui-grid-resize-columns ui-grid-auto-resize><ui-grid-tip total="gridprogram.totalItems"/></div></div>
js:
var myHeaderCellTemplate = '编辑'; $scope.gridOptions = {enableRowSelection: true, //行选择是否可用,默认为trueenableSelectAll: true, //选择所有checkbox是否可用,默认为truemultiSelect: true,//是否可以选择多个,默认trueselectionRowHeaderWidth: 35,//设置选择列的宽度rowHeight: 35,showGridFooter: false,useExternalPagination: true, //是否使用分页按钮paginationPageSizes: [10, 20, 30],paginationPageSize: 10, //每页的记录数enableHorizontalScrollbar: 0,//是否使用横向滚动条,0.不使用,1.使用onRegisterApi: function(gridApi) {$scope.gridApi = gridApi; //方便使用gridApi的方法、属性等 //分页触发的函数gridApi.pagination.on.paginationChanged($scope, function(pageNumber, pageSize) {currentPage = pageNumber;currentPageSize = pageSize;// 获取当前页数据 getPage(pageNumber, pageSize);});//行选中事件gridApi.selection.on.rowSelectionChanged($scope, function(row) {//row.isSelected返回该行是否选中});},enableSorting: false,columnDefs: [{field: 'name',name: '名称',width: '120',enableColumnMenu: false, // 是否显示列头部菜单按钮}, {field: "uuid",width: '**',name: '操作',enableColumnMenu: false,cellTemplate: myHeaderCellTemplate //自定义该列的显示}]};
// 给表格赋值
$scope.gridOptions.data = []; $scope.gridOptions.totalItems = 10;
---------------------------页操作----------------------------
1. 获取当前页码:$scope.gridApi.pagination.getPage()
2. 获取总页码:$scope.gridApi.pagination.getTotalPages()
3. 跳转到第2页:$scope.gridApi.pagination.seek( 2 )
4. 前一页:$scope.gridApi.pagination.previousPage()
5.下一页:$scope.gridApi.pagination.nextPage()
----------------选择操作-ui-grid-selection---------------------------
1.获取选中的行:$scope.gridApi.selection.getSelectedGridRows()
2.取消所有选中的行:$scope.gridApi.selection.clearSelectedRows();
阅读全文
0 0
- ui-grid 常用操作
- C# UI常用操作
- Oracle 11g R2 Grid常用操作
- Liger ui grid 参数
- ui-grid 网格布局
- kendo ui grid 汉化
- ui-grid的笔记
- angular ui-grid行单选
- ui-grid 使用讲解
- ui-grid 使用讲解
- 十、UI-Grid CellClass
- 十四、UI-Grid HeaderCellClass
- 十六、UI-Grid 菜单栏
- UI-Grid 排序
- ui-grid(1)--基础
- 改写ui-grid headerCellTemplate
- Kendo UI Grid
- Kendo UI Grid
- Dubbo使用入门xml配置
- Linux dpkg命令
- swagger+springmvc接口在线文档完美整合
- bidi(双向文字)与RTL布局总结
- 登录页面回车键的实现
- ui-grid 常用操作
- 在eclipse中启动tomcat报404错误
- 织梦内容管理系统模板标签代码参考
- Idea Debug 常用快捷键
- Deep Learning---py-faster-rcnn基于PASCAL VOC数据集训练模型
- HDU
- nginx 安装
- GuideView 引导库的使用
- echarts3 + 百度地图API展示自定义地图