[转]ng-grid
本文转自:http://angular-ui.github.io/ui-grid/
Getting Started
Steps for getting started (example on right):
- Add references to jQuery and AngularJS.
- Add references to ngGrid's javascript and css files.
- Where you declare your app module, add ngGrid:
angular.module('myApp',['ngGrid']);If you use angular seed, it is in your app.js file. - In your html file within the controller where you plan to use ng-grid, add:
<div class="gridStyle" ng-grid="gridOptions"></div>gridOptions is the variable we are going to bind to where we will initialize our grid options. - We are going to define a basic style for our grid in style.css:
.gridStyle {
border: 1px solid rgb(212,212,212);
width: 400px;
height: 300px
} - In your javascript file within the controller where you plan to use ng-grid, lets add data that our grid will use:
$scope.myData = [{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}];
- Now initialize your grid options under the same controller as data:
$scope.gridOptions = { data: 'myData' }; - Below is the outcome of the grid using the example on the right:
- name 0
- age 0
250
500
1000
/ 1
HTML:
- <html ng-app="myApp">
- <head lang="en">
- <meta charset="utf-8">
- <title>Getting Started With ngGrid Example</title>
- <link rel="stylesheet" type="text/css" href="ng-grid.css" />
- <link rel="stylesheet" type="text/css" href="style.css" />
- <script type="text/javascript" src="jquery-1.8.2.js"></script>
- <script type="text/javascript" src="angular.js"></script>
- <script type="text/javascript" src="ng-grid-1.3.2.js"></script>
- <script type="text/javascript" src="main.js"></script>
- </head>
- <body ng-controller="MyCtrl">
- <div class="gridStyle" ng-grid="gridOptions">
- </div>
- </body>
- </html>
CSS:
- /*style.css*/
- .gridStyle {
- border: 1px solid rgb(212,212,212);
- width: 400px;
- height: 300px
- }
Javascript:
- // main.js
- var app = angular.module('myApp', ['ngGrid']);
- app.controller('MyCtrl', function($scope) {
- $scope.myData = [{name: "Moroni", age: 50},
- {name: "Tiancum", age: 43},
- {name: "Jacob", age: 27},
- {name: "Nephi", age: 29},
- {name: "Enos", age: 34}];
- $scope.gridOptions = { data: 'myData' };
- });
View the plunker here.
[转]ng-grid的更多相关文章
- ExtJS自制表格Grid分页条
试过Grid自带的load和分页功能,没有成功,干脆就自己写了...... 主要是查询条件比较复杂...... 希望哪位大神能有更好的意见. Ext.define('MyApp.ux.Paginati ...
- Andrew Ng机器学习入门——线性回归
本人从2017年起,开始涉猎机器学习.作为入门,首先学习的是斯坦福大学Andrew Ng(吴恩达)教授的Coursera课程 2 单变量线性回归 线性回归属于监督学习(Supervise Learni ...
- 【原】Coursera—Andrew Ng机器学习—编程作业 Programming Exercise 4—反向传播神经网络
课程笔记 Coursera—Andrew Ng机器学习—课程笔记 Lecture 9_Neural Networks learning 作业说明 Exercise 4,Week 5,实现反向传播 ba ...
- [C2P2] Andrew Ng - Machine Learning
##Linear Regression with One Variable Linear regression predicts a real-valued output based on an in ...
- ExtJS 4.2 Grid组件的单元格合并
ExtJS 4.2 Grid组件本身并没有提供单元格合并功能,需要自己实现这个功能. 目录 1. 原理 2. 多列合并 3. 代码与在线演示 1. 原理 1.1 HTML代码分析 首先创建一个Grid ...
- WPF中Grid实现网格,表格样式通用类
/// <summary> /// 给Grid添加边框线 /// </summary> /// <param name="grid"></ ...
- 在 Windows Phone 中,为 Grid 添加 Tilt 效果
在 Windows Phone 中,Tilt 效果是比较经典的效果,我们可以很简单的为按钮等控件添加这样的效果(使用 Windows Phone Toolkit 的Tilt 效果),但是,如果我们想要 ...
- wpf 列表、菜单 收起与展开,通过Grid DoubleAnimation或者Expander实现
菜单收缩有很多种方法具体如何实现还是看个人想法: 第一种通过后台控制收起与展开: 效果图: 代码 : <Grid> <Grid.ColumnDefinitions> <C ...
- Sencha ExtJS 6 Widget Grid 入门
最近由于业务需要,研究了一下Sencha ExtJS 6 ,虽然UI和性能上据相关资料说都有提升,但是用起来确实不太顺手,而且用Sencha cmd工具进行测试和发布,很多内部细节都是隐藏的,出了问题 ...
- WPF CheckBox样式 ScrollViewer样式 WrapPanel、StackPanel、Grid布局
本节讲述布局,顺带加点样式给大家看看~单纯学布局,肯定是枯燥的~哈哈 那如上界面,该如何设计呢? 1.一些布局元素经常用到.Grid StackPanel Canvas WrapPanel等.如上这种 ...
随机推荐
- Vue.js – 基于 MVVM 实现交互式的 Web 界面
Vue.js 是用于构建交互式的 Web 界面的库.它提供了 MVVM 数据绑定和一个可组合的组件系统,具有简单.灵活的 API.从技术上讲, Vue.js 集中在 MVVM 模式上的视图模型层,并 ...
- Ratatype - 在线打字教程,提高打字速度
Ratatype 是一个在线的打字教程网站,帮助人们提高键盘输入速度.开始掌握你的技能,挑战你的朋友或得到一个打字的证书.如果打字慢会浪费你宝贵的时间.如果你的打字速度提高30%,您可以每天节省20分 ...
- ADN用户的产品激活方法
如果您是ADN用户,在使用在线激活产品时遇到问题导致不能激活时,您可以采用手动激活方式. 通常采用如下两种方式. 1. (推荐)ADN用户填写此表格提交申请,同时在补充信息中提供 ADN Develo ...
- GPS定位为什么要转换处理?高德地图和百度地图坐标处理有什么不一样?
GPS定位为什么要转换处理?高德地图和百度地图坐标处理有什么不一样? 先了解一下 高德地图 采用: GCJ-02 (不可逆) 百度百科: http://baike.baidu.com/link?url ...
- Java8 Lambda表达式教程
转自:http://blog.csdn.net/ioriogami/article/details/12782141 1. 什么是λ表达式 λ表达式本质上是一个匿名方法.让我们来看下面这个例子: pu ...
- UISlider相关
设置slider当前位置的图像 [slider setThumbImage:[UIImage imageNamed:@"dd.png"] forState:UIControlSta ...
- Warning: Attempt to present on whose view is not in the window hierarchy!
当我想从一个VC跳转到另一个VC的时候,一般会用 - (void)presentViewController:(UIViewController *)viewControllerToPresent a ...
- pod install 和 pod update的区别
pod install 和 pod update的区别 pod install(下载并安装pod) 1,当pod file文件中有“增加pod,删除pod,修改pod”的操作之后使用. 2,pod i ...
- Java 线程通信
线程通信用来保证线程协调运行,一般在做线程同步的时候才需要考虑线程通信的问题. 1.传统的线程通信 通常利用Objeclt类提供的三个方法: wait() 导致当前线程等待,并释放该同步监视器的锁定, ...
- VS2015 Git 插件使用教程
VS2015 中继承了 Git 插件,再也不用下载 Github for Windows了. 从 团队-管理连接 中打开 团队资源管理器 克隆Repository 在 本地 Git 存储库下面点击 ...