Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Re: Help: Data Table, pass the status of checkboxes via post

Expand Messages
  • Satyam
    On the listener to some sort of submit button you can build the URL argument list by looping through the recordset: var recset =
    Message 1 of 3 , Aug 2, 2008
    • 0 Attachment
      On the listener to some sort of submit button you can build the URL argument list by looping through the recordset:


      var recset = this.myDataTable.getRecordset();
      var recsetlen = recset.getLength();
      var urlargs = '';
      for (var i = 0 ; i < recsetlen;i++) {
          var rec = recset.getRecord(i);
          if (rec.getData('id')) {
             urlargs += '&' + escape(rec.getData('Name')) + '=1';
          }
      }

      or something like that.  Then you append the whole of it to the base URL and you either use it in a call to asyncRequest or assign it to window.location.

      Satyam

      mattixtech wrote:
      --- In ydn-javascript@yahoogroups.com, "mattixtech" <mattixtech@...>
      wrote:
        
      Hello,
      
      First off I'm new here and fairly new to programming in general so if
      this question sounds very noobie that's why :P.
      
      I have created a data table that will be storing several rows of
      content with a check box for each row. I would like the user to be
      able to place a check beside multiple rows and then submit the data
      table similar to a form submit via POST.
      
      I have a php script to check the values passed to it and if it
      determines the check box is checked for a specific row it deletes that
      row from the database.
      
      I am just wondering what the code would be to submit the status of all
      the check boxes to a php script.
      
          
      Oops. I wasn't very specific.
      
      The data table I am using is the yui data table.
      
      Here are my columns:
       var myColumnDefs = [
                  {key:"id",label:' ',formatter:"checkbox"},
                  {key:"Name",sortable:true,resizeable:true},
                  {key:"Email",formatter:YAHOO.widget.DataTable.formatEmail,
      sortable:true, resizeable:true},
                  {key:"Location", sortable:true, resizeable:true},
                  {key:"Phone",
      formatter:YAHOO.widget.DataTable.formatNumber,sortable:true,
      resizeable:true}
              ];
      
      Here is my checkbox checking code:
      
           this.myDataTable.subscribe("checkboxClickEvent", function(oArgs){
             var elCheckbox = oArgs.target;
             var elRecord = this.getRecord(elCheckbox);
             var name = elRecord.getData("id");
             var elColumn = this.getColumn(elCheckbox);
              this.getRecordSet().updateKey(elRecord,
      elColumn.key,elCheckbox.checked);
      
      }); 
      
      
      ------------------------------------
      
      Yahoo! Groups Links
      
      <*> To visit your group on the web, go to:
          http://groups.yahoo.com/group/ydn-javascript/
      
      <*> Your email settings:
          Individual Email | Traditional
      
      <*> To change settings online go to:
          http://groups.yahoo.com/group/ydn-javascript/join
          (Yahoo! ID required)
      
      <*> To change settings via email:
          mailto:ydn-javascript-digest@yahoogroups.com 
          mailto:ydn-javascript-fullfeatured@yahoogroups.com
      
      <*> To unsubscribe from this group, send an email to:
          ydn-javascript-unsubscribe@yahoogroups.com
      
      <*> Your use of Yahoo! Groups is subject to:
          http://docs.yahoo.com/info/terms/
      
      
      No virus found in this incoming message.
      Checked by AVG - http://www.avg.com 
      Version: 8.0.138 / Virus Database: 270.5.10/1585 - Release Date: 01/08/2008 6:39
      
      
      
        
    Your message has been successfully submitted and would be delivered to recipients shortly.