    function setSearch(url, sortCol) {
      if (sortCol==null)
         return url
      if (url.indexOf("?")== -1)  // if no search params, just add sortCol
        url = url + "?__sort=" + sortCol
      else {
        if (url.indexOf("__sort")!=-1) { // if sort param exists, replace its value
          x = url.lastIndexOf("=")
          url = url.substring(0,x+1) + sortCol
        } else {  // if no sort param exists, add it and value
          url = url + "&__sort=" + sortCol
        }
      }
      return url
    }