[转]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等.如上这种 ...
随机推荐
- 关于mapcontrol和pagelayoutcontrol切换时闪退
今天遇到一个很奇怪的的现象,在tabcontrol里切换到pagelayout时,程序会闪退,试了下之前的程序,没有问题,去网上搜了一下,也没人有这样的问题,然后就开始实验,添加一个控件,运行一次,最 ...
- sharepoint2010问卷调查(3)-实现问卷的开始和结束时间(采用自定义字段类型)
接着上面的图片调查,sharepoint自带的问卷调查是没有开始和结束时间的.这个在项目过程不太实用.问卷一般有开始和结束时间的.因此需要自己 动手开发一个自定义字段类型字段.如下图: 开发添加栏目会 ...
- CSAW2013
竞赛地址:https://ctf.isis.poly.edu/challenges/ 第一关:Trivia Trivia意思为琐事,每题分值50,比较简单 1.Drink all the booze, ...
- Android终止线程的方法
线程对象属于一次性消耗品,一般线程执行完run方法之后,线程就正常结束了,线程结束之后就报废了,不能再次start,只能新建一个线程对象.但有时run方法是永远不会结束的.例如在程序中使用线程进行So ...
- Android消息机制入门
接着处理<Android 网络图片查看器>中出现的问题 使用添加子线程,修改原程序: package com.wuyudong.imagesviewer; import java.io.I ...
- tomcat WEB-INF中的结构
tomcat中 WEB-INF中结构包含3个东西:web.xml,classes文件夹,lib文件夹 web.xml用来配置web中服务调用的uri和对应服务指定的是哪个class文件 classes ...
- IOS整体项目层级构建
在创建IOS项目时,若有一个比较明确的层级架构,将对于今后代码的维护或者功能的扩展很有帮助:本文将通过一个实例来展现我对于层级的一些观点:里面有一些零碎的知识点可能无法全部介绍,到时提供源代码进行下载 ...
- Eclipse为成员变量设置前缀
Eclipse可以自动生成getter和setter,constructor. 菜单 - Source, 有Generate Getters and Setter,Generate Construct ...
- 【代码笔记】iOS-判断是否是模拟机
一,代码. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. ...
- Markdown语法手册
Markdown 语法手册 Markdown 是一种轻量级标记语言,能将文本换成有效的XHTML(或者HTML)文档,它的目标是实现易读易写,成为一种适用于网络的书写语言. Markdown 语法简洁 ...