Editor.edit(): how to pick up data from data model
Editor.edit(): how to pick up data from data model
I tested that the editor can pick up data by the jQuery selector from the DOM. however I cannot make it pick up data from the table object, please check if this is possible (and how). For me, edit the data model is more nature than edit the DOM. Please see http://54.199.175.35/3 for the test case. The ajax data is as bellow:
{ tb_titles:
[ 'ID',
'Product Name',
'Catalogue',
'Description',
'Create Time',
'Status' ],
tb_data:
[ { id: 1,
name: 'as_o_agent',
catalogue: 'Nibiru',
description: 'act as origination agent',
create_time: '2017-03-09T22:13:35.000Z',
status: 'active' },
{ id: 2,
name: 'as_t_agent',
catalogue: 'Nibiru',
description: 'act as termination agent',
create_time: '2017-03-09T22:13:58.000Z',
status: 'active' } ] }
Answers
You are declaring the
table
variable inside thedraw_table
function. I don't think this variable will be available outside that function. I would declare both theeditor
andtable
variables more globally like before$(document).ready
.Kevin
Hi @kthorngren, it is passed as a parameter to the draw_editor(table).