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

Reference yui elements in the DOM

Expand Messages
  • sbjohnson256
    Hi Satyam, I need to reference a YUI.widget.DataTable outside the function that creates the element. I am using javascript to try to reference the it. Would
    Message 1 of 1 , Dec 1, 2009
    • 0 Attachment
      Hi Satyam,

      I need to reference a YUI.widget.DataTable outside the function that creates the element. I am using javascript to try to reference the it. Would you please supply me with code to accomplish this. Below is a code snippet of the function.

      Thanks in advance,
      Suzanne

      function displayCPTtable(cptId) {
      var pagesize=10;
      cptAry = [];
      var returnstring = #server(..createCPTArray(cptId))#;
      var ary = returnstring.split("~");
      var count = ary.length;
      var row, code, modifier, units;
      for (var idx = 0; idx < count; idx++) {
      var data = ary[idx].split("^");
      row = idx+1;
      code = data[0];
      modifier = data[1];
      units = data[2];
      cptAry[idx] = {row:row, code:code, modifier:modifier, units:units};
      };

      var myColumnDefs = [
      {key:"row", label:"Row"},
      {key:"code", label:"CPT Code},
      {key:"modifier", label:"Modifier},
      {key:"units", label:"Units}];
      var myDataSource = new YAHOO.util.DataSource(cptAry);
      myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
      myDataSource.responseSchema = {fields : ["row","code","modifier","units"]};

      myPaginator = new YAHOO.widget.Paginator({
      rowsPerPage: pagesize,
      totalRecords : count,
      containers : cptPaging,
      template: "{PreviousPageLink} <strong>{CurrentPageReport}</strong> {NextPageLink}"
      });

      var oConfigs = {
      paginator: myPaginator,
      selectionMode:"single",
      initialRequest: "results=" + count
      };

      var myDataTable = new YAHOO.widget.DataTable("cptTable", myColumnDefs, myDataSource, oConfigs);
    Your message has been successfully submitted and would be delivered to recipients shortly.