changes for onclick
This commit is contained in:
parent
d678f2bd02
commit
fe10eabff8
@ -2,6 +2,7 @@
|
||||
|
||||
Java Script for https://github.com/go-gitea/gitea/pull/7980 (Sortable Tables) .. by header click
|
||||
|
||||
sortt( [normsort], (revsort), (isdefault) )
|
||||
|
||||
## Routine Idear
|
||||
1. add to table head colum onclick="sortt('sort parameters')"
|
||||
|
23
sortt.js
23
sortt.js
@ -17,24 +17,15 @@ if (window.sortt_url.indexOf("sort=") < 0) {
|
||||
window.sortt_url=window.sortt_url.substr(0,window.sortt_url.indexOf("&"));
|
||||
}
|
||||
//creat global function with main routine
|
||||
window.sortt=function(sort_atr){
|
||||
//sortTable [sort attribute]
|
||||
window.sortt=function(normsort,revsort,isdefault){
|
||||
//sortTable [normsort] (revsort) (isdefault)
|
||||
|
||||
if (sort_atr.length = 0) return;
|
||||
//normsort is needet
|
||||
if (typeof normsort === 'undefined') return false;
|
||||
|
||||
//split sort_atribute in its parts
|
||||
sortdefault = false;
|
||||
if ( sort_atr.indexOf("*") == 0 ) {
|
||||
sortdefault = true;
|
||||
sort_atr = sort_atr.substr(1);
|
||||
}
|
||||
if ( sort_atr.indexOf(",") == -1 ) {
|
||||
revsort = "";
|
||||
normsort = sort_atr;
|
||||
} else {
|
||||
normsort = sort_atr.substr(0,sort_atr.indexOf(","));
|
||||
revsort = sort_atr.substr(sort_atr.indexOf(",")+1);
|
||||
}
|
||||
//default values of optinal parameters
|
||||
if (typeof revsort === 'undefined') revsort = "";
|
||||
if (typeof isdefault === 'undefined') isdefault = false;
|
||||
|
||||
// look at ReadMe
|
||||
console.log("sortTable() normsort:\"" + normsort + "\" revsort:\"" + revsort + "\" sortdefault:\"" + sortdefault + "\"");
|
||||
|
Reference in New Issue
Block a user