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
|
Java Script for https://github.com/go-gitea/gitea/pull/7980 (Sortable Tables) .. by header click
|
||||||
|
|
||||||
|
sortt( [normsort], (revsort), (isdefault) )
|
||||||
|
|
||||||
## Routine Idear
|
## Routine Idear
|
||||||
1. add to table head colum onclick="sortt('sort parameters')"
|
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("&"));
|
window.sortt_url=window.sortt_url.substr(0,window.sortt_url.indexOf("&"));
|
||||||
}
|
}
|
||||||
//creat global function with main routine
|
//creat global function with main routine
|
||||||
window.sortt=function(sort_atr){
|
window.sortt=function(normsort,revsort,isdefault){
|
||||||
//sortTable [sort attribute]
|
//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
|
//default values of optinal parameters
|
||||||
sortdefault = false;
|
if (typeof revsort === 'undefined') revsort = "";
|
||||||
if ( sort_atr.indexOf("*") == 0 ) {
|
if (typeof isdefault === 'undefined') isdefault = false;
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// look at ReadMe
|
// look at ReadMe
|
||||||
console.log("sortTable() normsort:\"" + normsort + "\" revsort:\"" + revsort + "\" sortdefault:\"" + sortdefault + "\"");
|
console.log("sortTable() normsort:\"" + normsort + "\" revsort:\"" + revsort + "\" sortdefault:\"" + sortdefault + "\"");
|
||||||
|
Reference in New Issue
Block a user