changes for onclick

This commit is contained in:
6543 2019-08-27 16:35:45 +02:00
parent d678f2bd02
commit fe10eabff8
Signed by: 6543
GPG Key ID: A1CA74D27FD13271
2 changed files with 8 additions and 16 deletions

View File

@ -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')"

View File

@ -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 + "\"");