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

Re: [ydn-javascript] Solve for click-show dropdowns in DataTable (+ Feature request)

Expand Messages
  • Satyam
    We were talking about this just yesterday: http://tech.groups.yahoo.com/group/ydn-javascript/message/50910 Satyam
    Message 1 of 1 , Aug 1, 2009
    View Source
    • 0 Attachment
      We were talking about this just yesterday:

      http://tech.groups.yahoo.com/group/ydn-javascript/message/50910

      Satyam


      benjamin_m_hill escribió:
      >
      >
      > I had an issue where using a DataTable's
      > YAHOO.widget.DropdownCellEditor wasn't showing the right Label/Value
      > combination. Satyam posted a solve in
      > http://www.nabble.com/Problem-with-label-value-in-a-DropDownCellEditor-td21609530.html
      > and I added just a bit to make it more generalized.
      >
      > You make your own formatter function: (bold=new generalization)
      >
      > /** Custom formatter for using label/value paired dropdowns */
      > function LabelValueFormat(el, oRecord, oColumn, oData) {
      > for ( var i = 0; i < *oColumn.editor.dropdownOptions.length*; i++) {
      > if (oData == *oColumn.editor.dropdownOptions[i].value*) {
      > el.innerHTML = *oColumn.editor.dropdownOptions[i].label*;
      > return;
      > }
      > }
      > }
      >
      > And then call it in your "myColumnDefs" as
      >
      > ....{ ... },
      > {
      > key : "requester_id",
      > label : "Requested By",
      > // formatter : "dropdown",
      > // dropdownOptions : contactsEmail,
      > sortable : true,
      > resizeable : false,
      > editor : new YAHOO.widget.DropdownCellEditor( {
      > dropdownOptions : contactsEmail,
      > disableBtns : true
      > }),
      > formatter : LabelValueFormat
      > }
      >
      > -----
      >
      > Feature request: This is how I expected it to act out of the box when
      > passed a list of values that are label/value instead of a string
      > array, took some digging to find out that it doesn't work that way.
      > Thanks!
      >
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - www.avg.com
      > Version: 8.5.392 / Virus Database: 270.13.38/2274 - Release Date: 07/31/09 05:58:00
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.