FancyGrid AngularJS directive


FancyGrid has AngularJS directive.
It is provided with sources and available on code.fancygrid.com .

Include files from code.fancygrid.com


<link href="http://code.fancygrid.com/fancy.min.css" rel="stylesheet">
<script src="http://code.fancygrid.com/fancy.min.js"></script>
<script src="http://code.fancygrid.com/fancy-angular.js"></script>

Load from own domain

Download latest build Latest Build.
And include files on your page.

<link href="/fancygrid/fancy.min.css" rel="stylesheet">
<script src="/fancygrid/fancy.min.js"></script>
<script src="/fancygrid/fancy-angular.js"></script>

FancyGrid Sample


<fancygrid id="myGrid" fg-config="config"></fancygrid>

...

var data = [
  {name: 'Ted', surname: 'Smith', company: 'Electrical Systems', age: 30},
  {name: 'Ed', surname: 'Johnson', company: 'Energy and Oil', age: 35},
  {name: 'Sam', surname: 'Williams',  company: 'Airbus', age: 38},
  {name: 'Alexander', surname: 'Brown', company: 'Renault', age: 24},
  {name: 'Nicholas', surname: 'Miller', company: 'Adobe', age: 33},
  {name: 'Andrew', surname: 'Thompson', company: 'Google', age: 28},
  {name: 'Ryan', surname: 'Walker', company: 'Siemens', age: 39},
  {name: 'John', surname: 'Scott', company: 'Cargo', age: 45},
  {name: 'James', surname: 'Phillips', company: 'Pro bugs', age: 30},
  {name: 'Brian', surname: 'Edwards', company: 'IT Consultant', age: 23},
  {name: 'Jack', surname: 'Richardson', company: 'Europe IT', age: 24},
  {name: 'Alex', surname: 'Howard', company: 'Cisco', age: 27},
  {name: 'Carlos', surname: 'Wood', company: 'HP', age: 36},
  {name: 'Adrian', surname: 'Russell', company: 'Micro Systems', age: 31},
  {name: 'Jeremy', surname: 'Hamilton', company: 'Big Machines', age: 30},
  {name: 'Ivan', surname: 'Woods', company: '', age: 24},
  {name: 'Peter', surname: 'West', company: 'Adobe', age: 26},
  {name: 'Scott', surname: 'Simpson', company: 'IBM', age: 29},
  {name: 'Lorenzo', surname: 'Tucker', company: 'Intel', age: 29},
  {name: 'Randy', surname: 'Grant', company: 'Bridges', age: 30},
  {name: 'Arthur', surname: 'Gardner', company: 'Google', age: 31},
  {name: 'Orlando', surname:'Ruiz', company: 'Apple', age: 32}
];

var app = angular.module('myApp', ['fancygrid-angularjs']);

app.controller('MainController', function($scope, $interval, $compile){
	$scope.config = {
    width: 500,
    height: 400,
    data: data,
    columns: [{
      index: 'company',      
      title: 'Company',
      type: 'string',
      width: 100
    },{
      index: 'name',
      title: 'Name',
      type: 'string',
      width: 100
    },{
      index: 'surname',
      title: 'Sur Name',
      type: 'string',
      width: 100
    },{
      index: 'age',
      title: 'Age',
      type: 'number',
      width: 100
    }]
  };
});

FancyForm Sample


<fancyform id="myForm" fg-config="config"></fancyform>

...

var app = angular.module('myApp', ['fancyform-angularjs']);


app.controller('MainController', function($scope, $interval, $compile){
  $scope.config = {
    renderTo: 'form',
    title: 'User Data',
    width: 290,
    height: 500,
    defaults: {
      type: 'string'
    },
    items: [{
      name: 'id',
      type: 'hidden'
    },{
      label: 'Name',
      emptyText: 'Name',
      name: 'name'
    },{
      label: 'SurName',
      emptyText: 'SurName',
      name: 'surname'
    },{
      label: 'E-mail',
      emptyText: 'E-mail',
      name: 'email',
      valid: {
        type: 'email',
        blank: false,
        blankText: 'Required',
        text: 'Incorect email'
      }
    },{
      type: 'date',
      label: 'Birthday',
      name: 'birthday'
    },{
      type: 'checkbox',
      label: 'Active',
      name: 'active',
      value: true
    },{
      type: 'number',
      label: 'Hour rate',
      name: 'hour',
      min: 0
    },{
      type: 'string',
      label: 'Position',
      name: 'position'
    },{
      type: 'combo',
      label: 'Country',
      name: 'country',
      data: [
        {country: 'USA'},
        {country: 'Canada'},
        {country: 'England'},
        {country: 'Germany'}
      ],
      displayKey: 'country',
      valueKey: 'country'
    },{
      type: 'textarea',
      label: 'About',
      name: 'about'
    }],
    buttons: ['side', {
      text: 'Clear',
      handler: function(){
        
      }
    },{
      text: 'Save',
      handler: function(){
       
      }
    }]
  };
});