-1
我正在使用jquery mobile 1.4開發應用程序。我有這個問題,當我使用編輯表單編輯項目時,所做的更改保存在localStorage中,但是當我訪問列表視圖頁面時,除非手動刷新頁面,否則它不會反映出來。如何在單個html5 jquery移動應用程序中刷新頁面
我保存表單的事件是這樣的
//After the selected employees has been edited
localStorage.setItem("employees", JSON.stringify(employees)); //set the update values to localstorage
alert('Employee Updated Successfully');
$('#employees_list').listview('refresh');
$.mobile.changePage("#home_page");
所以我不手動刷新我加
history.go(0);
與history.go的問題(0);在使用phonegap進行編譯後,它顯示一個空白屏幕並在重新加載時需要退出一段時間,這看起來好像應用程序崩潰了。
因此,如何刷新listview頁面而不必重新加載整個html文件的任何建議? 它是在幾秒鐘後列表視圖頁面
id = '#employee_list_view_page'.
或可選擇地將它設置爲停止(或暫停)一個HTML5頁面,因此用戶不認爲應用程序已經崩潰。 謝謝
謝謝你能給我一個關於如何重新加載列表視圖與新數據的線索。在我最初添加員工的表單中,我有這個職能employees.push(newEmployee);和addEmployee(newEmployee); – user3650900 2014-08-30 03:09:01
謝謝@ Lakmal我明白了。正如你所說我沒有用新數據重新加載列表,我錯過了showEmployees();現在起作用的功能 – user3650900 2014-09-01 19:04:33