$("#tree").jstree({
plugins : ( /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) ? ["state","types","grid"] : ["state","types","dnd","grid"],
core : {
check_callback:true, // Enables create, rename, move & delete
themes:{stripes:true,icons:true,dots:true,url:false,responsive:false},
multiple:false,
data:function(node,cb){cb(get_JSON());}
},
// include relevant parameters
grid: {
columns: [
{width: 600, header: "Items",title:"_DATA_"},
{wideCellClass: "unit_cell", value: function(node){ return node.PRICE?(node.PRICE/node.qty):""; }, width: 90, header: "Unit Price"},
{wideCellClass: "total_cell", value: function(node){ return node.PRICE?node.PRICE+" ":""; }, width: 90, header: "Total"}
]
},
dnd : {
copy:false
}
},
state : { key : job_id },
types : {
"#" : { // Root
"valid_children" : ["heading","stock"]
},
"default" : {}, // No type assigned
"heading" : {
valid_children : ["heading","stock"]
},
"stock" : {
icon : "/images/stock.png",
max_depth : 1,
valid_children : ["stock"]
}
}
})
// Prevent link click
.delegate("a", "click", function (event, data) { event.preventDefault(); })
.bind('move_node.jstree', function(event, data) { move_item_node(data) })
.bind("dblclick.jstree", function (event) { edit_item(); })
.bind("changed.jstree", function() { enable_items_menus(); })
.on("select_cell.jstree-grid", function(event, dta) { alert("HI"); })
.disableSelection(); // Stops user selecting text