How to update jQuery mobile tables
I want to create a table in jQuery mobile. The table will be updated from mysql. Please tell me the procedure to create and update the table in jQuery mobile.I am completely new to the platform.
You should use AJAX to update your table without refreshing the page. From your jquery/html page you do an ajax call to update the table after you add new data to it (I assume this is why you need to update).
It works something like this:
Have a separate script to DISPLAY your table
Use JQUERY AJAX to display the table for you on page load
$(document).on("pageinit", "#visualUnitList", function () {
LoadVisualUnitTable();
});
Write the function to display the table
function LoadVisualUnitTable() {
$.post('unit_DisplayVisualTable.php', 'unitSearchBox=<?php echo $_POST ['unitSearchBox'];?>, function(data) {
$("#visualUnitListTable-popup-popup").remove(); //<!-- remove "select columns to display" popup from dom before reloading - fix for button not working after reload -->
$("#visualUnitTable").html(data).enhanceWithin();//<!-- load data to div -->
});
return false;
};
This will make your table appear on the screen. If you want to update it/edit the data in the table you need to write more ajax to POST the data to a separate php(?) script. After you have posted your data you will simply run LoadVisualUnitTable()
as I have in point 1. within your AJAX.
I hope this can help.
ps For any future questions you might ask, it's much easier to write a response if you give more details about what you are trying to achieve, and even better if you can post existing code that you've been working on.
链接地址: http://www.djcxy.com/p/65386.html上一篇: 如何查看表或列的所有外键?
下一篇: 如何更新jQuery移动表