Menu

paging parameter generation

Ted X Toth
2004-08-03
2012-10-09
  • Ted X Toth

    Ted X Toth - 2004-08-03

    I use a table decorator to create checkboxes. I need to do a submit via the onclick of these checkboxes so as to  maintain their state. How can I generate the correct paging parameter to return me to the same page of my table (ex. d-1588-p=2)?

     
    • srisubu

      srisubu - 2004-11-22

      We found the work around using the Javascript. Here is the javascript that you need to call in your onclick event of your checkbox

      function saveProcess() {
      var urlpath = '/myProject/do/SaveProcess?';

      // dprtElement is shorthand for the displayTable 
      // displayTable is your displayTag Table id
      

      HTMLTableElement
      var dprtElement = document.getElementById( 'displayTable' );

      // dtscElement is short for displaytag sortable column element
      // we find that in the for loop that follows
      var dtscElement = null;
      var headerCells = dprtElement.rows[0].cells;
      
      for( var i = 0; i < headerCells.length; i++ ) {
          var cell = headerCells[i];
          //Name is your sortable column name
          if( cell.innerHTML.match(/Name/i) != null ) {
              dtscElement = cell;         
              break;
          }
      }
      //Getting the AnchorTag parameterlist    
      var displayTagAnchorElement = dtscElement.getElementsByTagName('a')[0];
      
      var queryStringMap = getQueryStringMap( displayTagAnchorElement.search );
      
      for( var key in queryStringMap ) {
      
       urlpath = urlpath + key + '=' +queryStringMap[key] + '&';
      }
      
      openedWindow = window.open(urlpath,'_self','',false);
      openedWindow.focus();
      

      }

      // Examine a query string and attempt to return an object that may
      // be used as a map (JavaScript associative array) where each key in
      // the query string is a property of the object property having the
      // same value inidicated by the key of the same name in the query
      // string.  Psuedo JavaScript may help explain.  Given a call that
      // is effectively something like
      //
      //    map = getQueryStringMap( '?bar=baz&homer=doh' );
      //
      //        then
      //
      //    map['bar'] would return 'baz'
      //
      //        and
      //
      //    map['homer'] would return 'doh'
      //
      

      function getQueryStringMap( queryString ) {
      var arrayOfKeyedValues = parseKeyValues( queryString );
      var map = parseKeyValuesIntoAssocativeArray( arrayOfKeyedValues );
      return map;
      }

       

Log in to post a comment.

MongoDB Logo MongoDB