Click to See Complete Forum and Search --> : Two Events


gnanesh
05-21-2003, 10:12 AM
folks

i have a table where in i am sorting by column name i.e. by href , this is an JSP application, right now i am sorting by ASCENDING order with one click on the link(column name), I need to sort by DESCENDING order with another click , Let me know if any one knows how to sort ASC & DES with 2 clicks on the links, any code is appreciated

thanks
gnanesh

khalidali63
05-21-2003, 10:17 AM
just put a flag in the function that sorts ASC and when the second time it registers a click check the value of that flag,..

gnanesh
05-21-2003, 10:21 AM
thanks for the mail, by the way below is my code

function sortColumn(cName){
var extraParams = "";
var compName = "<%=DealLocatorConstants.FLD_COMPANY_NAME%>";
var dValue = "<%=DealLocatorConstants.FLD_DEAL_VALUE%>";
var scrMgr = "<%=DealLocatorConstants.FLD_SCREENING_MANAGER%>";
if(compName == cName){
extraParams += "&" + "<%=DealLocatorConstants.FLD_COLUMN_TO_SORT%>" + "=" + cName;
}else if(dValue == cName){
extraParams += "&" + "<%=DealLocatorConstants.FLD_COLUMN_TO_SORT%>" + "=" + cName;
}else if(scrMgr ==cName){
extraParams += "&" + "<%=DealLocatorConstants.FLD_COLUMN_TO_SORT%>" + "=" + cName;
}
var url = "<portlet:createWebflowURL namespace='<%=DealLocatorConstants.NAMESPACE_DEAL_TRACKING%>' event='<%=DealLocatorConstants.RK_COLUMN_SORT%>'/>";
url += extraParams;
window.location.replace(url);
}


Above is the function , which will be called when the user clicks on any of the Table column(link), Let me know where do i set the flag to call one more EVENT

Thanks
gnanesh

khalidali63
05-21-2003, 10:30 AM
Make flag global

var isCLicked = false;

function sortColumn(cName){
if(!isCLicked){
isClicked = true;
}else{
isClicked = false;
}

//it depends which way you want to go,but essentially the above will do that for you.