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

different drop down options for each row in a dataTable

Expand Messages
  • hedibensaid
    I want to have different drop down option for a column. example in my data table I have a column named country in the first row I would like to have France,
    Message 1 of 3 , Dec 30, 2008
    • 0 Attachment
      I want to have different drop down option for a column.
      example
      in my data table I have a column named country
      in the first row I would like to have France, Belgium, Tunisia
      in the second row I would like to have Italy, Germany
      how can I do this
    • Andy Bui
      Hi hedibensaid, You can do that by get a reference to the dropdown control of each row and manipulate its values. Here is a sample function to get the
      Message 2 of 3 , Dec 31, 2008
      • 0 Attachment
        Hi hedibensaid,

        You can do that by get a reference to the dropdown control of each
        row and manipulate its values.

        Here is a sample function to get the reference of the dropdown from
        specified cell:

        function GetDropwdownFromCell(iDataTable,iRow,iCol)
        {
        var obj = {
        record:iRow,
        column:iCol
        };

        var td = iDataTable.getTdEl(obj);

        var dropdowns = td.getElementsByTagName("select");

        var dropdown;
        if(dropdowns.length>0)
        dropdown = dropdowns[0];

        return dropdown;
        }

        var dropdown = GetDropwdownFromCell(dt,row,col);

        Now you can manipulate the dropdown as needed
        // add new list of value
        dropdown.innerHTML="";//remove the default list if need

        // add new values
        var o = document.createElement("option");
        o.value="France";
        o.innerHTML = "France";
        dropdown.appendChild(o);

        // .. continue with other values

        Hope this help,

        Andy Bui


        --- In ydn-javascript@yahoogroups.com, "hedibensaid"
        <hedibensaid@...> wrote:
        >
        > I want to have different drop down option for a column.
        > example
        > in my data table I have a column named country
        > in the first row I would like to have France, Belgium, Tunisia
        > in the second row I would like to have Italy, Germany
        > how can I do this
        >
      • Satyam
        The dropdown formatter cannot handle that, you will have to make your own formatter: http://developer.yahoo.com/yui/datatable/#format Satyam
        Message 3 of 3 , Dec 31, 2008
        • 0 Attachment
          The dropdown formatter cannot handle that, you will have to make your
          own formatter:

          http://developer.yahoo.com/yui/datatable/#format

          Satyam


          hedibensaid wrote:
          > I want to have different drop down option for a column.
          > example
          > in my data table I have a column named country
          > in the first row I would like to have France, Belgium, Tunisia
          > in the second row I would like to have Italy, Germany
          > how can I do this
          >
          >
          >
          >
          >
          > ------------------------------------
          >
          > Yahoo! Groups Links
          >
          >
          >
          > ------------------------------------------------------------------------
          >
          >
          > No virus found in this incoming message.
          > Checked by AVG - http://www.avg.com
          > Version: 8.0.176 / Virus Database: 270.10.1/1868 - Release Date: 29/12/2008 10:48
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.