jquery-tabledit icon indicating copy to clipboard operation
jquery-tabledit copied to clipboard

Insert query result into column of editable array

Open jorgeribeiro opened this issue 7 years ago • 3 comments

This is my tabledit:
$('#usertable').Tabledit({ url: 'accountinfo.php', editButton: true, deleteButton: true, hideIdentifier: true, columns: { identifier: [0, 'id'], editable: [[1, 'name'], [2, 'email'], [3, 'admin', '{"1": "Yes", "0": "No"}'], [4, 'class']] }, onSuccess: function(data, textStatus, jqXHR) { viewData(); }, });

In the 4th column 'class' I would like to insert all the classes that I have in my database, like 1: Art, 2: Science, 3: History... and so on. But I want to get those classes from my database. I have a table called "class". How to insert them into the column and how to make the selection correctly? (to update in the database). Each class has its own id.

jorgeribeiro avatar Jul 25 '17 23:07 jorgeribeiro

insert into class (name, email, admin, class) value ('" . $input['name'] . "', '" . $input['email'] . "', '" . $input['admin'] . "', '" . $input['class'] . "')

xbox2007 avatar May 04 '18 21:05 xbox2007

$('#usertable').Tabledit({ url: 'accountinfo.php', editButton: true, deleteButton: true, hideIdentifier: true, columns: { identifier: [0, 'id'], editable: [[1, 'name'], [2, 'email'], [3, 'admin', '{"1": "Yes", "0": "No"}'], [4, 'class','{"1": "Art", "2": "Science", "3": "History"}']] }, onSuccess: function(data, textStatus, jqXHR) { viewData(); }, });

xbox2007 avatar May 04 '18 21:05 xbox2007

declare a variable with JSON format and pass it to your variable 4 as ..

..[4, 'class', $json]

sayanchak15 avatar May 24 '18 17:05 sayanchak15