ToothpickFactory / nsTable

Simple directive that takes JSON and creates a table from it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nsTable

Simple tool that takes JSON and creates a table from it.

#Dependencies lodash 3+

#Usage nsTable takes a JSON object that can contain "caption", "head", "body", and/or "foot".

{  
  "caption":"Your Awesome Caption!",
  "head":[],
  "body":[],
  "foot":[]
}

Each cell in the table is represented as an object in each array

{  
  "caption":"your Awesome Caption!",
  "head":[
    // Row
    [
      // Cell
      {
        "text": String,
        "action": function(cell){}
      }
    ]
  ]
}

Text: The thing to display in the cell

Action: Triggers a the function

rowOptions: Flags the builder to apply attributes to the row element

Unknown: Any key that does not have a constructor will be made into an attribute with the key as the name of the attribute and value as the value.

About

Simple directive that takes JSON and creates a table from it.


Languages

Language:JavaScript 92.8%Language:HTML 7.2%