提交 c6f17d09 编写于 作者: J Jesse Glick

ts_refresh

上级 4543ad3f
......@@ -44,6 +44,7 @@ import org.kohsuke.stapler.bind.JavaScriptMethod;
* (since it may be canceled if the user simply browses to another page while it is running).
* <ol>
* <li>Write a {@code <script>} section defining {@code function display(data)}.
* (Call {@code ts_refresh(document.getElementById('someid'))} if using a {@code sortable} table.)
* <li>Use {@code <l:progressiveRendering handler="${it.something()}" callback="display"/>} from your Jelly page to display a progress bar and initialize JavaScript infrastructure.
* <li>Implement {@code something()} to create an instance of your subclass of {@code ProgressiveRendering}.
* <li>Perform your work in {@link #compute}.
......
......@@ -179,6 +179,26 @@ function ts_resortTable(lnk) {
ts_saveDirection(table, column, dir);
}
/**
* Call when data has changed.
* @since XXX
*/
function ts_refresh(table){
var key = ts_getStorageKey(table);
if(ts_Storage.hasKey(key)){
var val = ts_Storage.getItem(key);
if(val){
var vals = val.split(":");
if(vals.length == 2) {
var colIndex = parseInt(vals[0]);
var col = table.rows[0].cells[colIndex];
var anchor = col.firstChild;
ts_resortTable(anchor);
}
}
}
}
function getParent(el, pTagName) {
if (el == null) return null;
else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) // Gecko bug, supposed to be uppercase
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册