jquery-tabledit
jquery-tabledit copied to clipboard
how i am going to create dropdown on Edit which is listed from DB Table
i tried below didn't work var athings = '';
$.ajax({ url: "company_data.php" }).done(function(data) { athings = data; dotable();
}).fail(function() { console.log("failed no ali"); athings = '{"1": "Apples", "2": "Beef", "3": "Candy"}'; dotable(); });
function dotable() { $('#editable_table').Tabledit({ url:'masrafsave.php', columns:{ identifier:[0, "id"], editable:[[3, 'no'], [4,'sub', athings ]] }, restoreButton:false, onSuccess:function(data, textStatus, jqXHR) { if(data.action == 'delete') { $('#'+data.id).remove(); } } }); }
});
Please let us know if anyone find out the answer for this
I need to create a dropdown menu from the DB as well :(
I got a solution. On each cell that belongs to one column, you set a class like "info-habitant" or what you want. Now when tabledit makes its modifications, you can select that class (which takes all cells with that class). Like this you can append or modify the options of the select with class "tabledit-input". You can update this with AJAX. (Beware that you will have to JSON.parse an array returned from PHP)
THINK "for (data of datas)"
$(".info-inhabitant").children(".tabledit-input").append("<option value='" + data["id"] + "'>" + data["name"] + " " + data["familyname"] + "</option>");