Skip to content

xguerin/ocaml-gridjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grid.js bindings for JSoO

Does as much as it says in the title. Documentation for the gridjs project. Currently requires the modified version of gridjs located here. Here is the related PR.

Example

open Js_of_ocaml
open Gridjs

let options ()=
  Grid.Options.make
    ~columns:
    [| Config.Column.make "First_Name"
     ; Config.Column.make "Last_Name"
     ; Config.Column.make "Email" |]
    ~server:(Config.Server.make ~then_:(fun a -> a) "/some/data.json")
    ~className:(Config.ClassName.make ())
    ~pagination:(Config.Pagination.make ~limit:5 true)
    ~search:(Config.Search.make true) () in

let _ =
  let target = Dom_html.document##getElementById (Js.string "target") in
  Js.Opt.case target
    (fun () -> ())
    (fun target ->
      let grid : _ Grid.t Js.t = new%js Grid.t options in
      grid##render target)