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

Re: [ydn-javascript] How can write custom function for dropdown?

Expand Messages
  • bahalul kabir
    Hi satyam, Ok I wanna do it in cellClickEvent . How can I get the selected value?? As I click on different cell
    Message 1 of 8 , Nov 3, 2009
    • 0 Attachment
      Hi satyam,
      Ok I wanna do it in cellClickEvent . How can I get the selected value?? As I click on different cell
      support_dataTable.subscribe("cellClickEvent",function(oArgs) {
         
          ar elDropdown = oArgs.target;     
             var oRecord = this.getRecord(elDropdown);
             selectItem=elDropdown.options[elDropdown.selectedIndex].value;
            alert(selectItem);  // does not work
       
      }


      From: Satyam <satyam@...>
      To: ydn-javascript@yahoogroups.com
      Sent: Tue, November 3, 2009 2:08:37 PM
      Subject: Re: [ydn-javascript] How can write custom function for dropdown?

       

      Nothing in your sample below shows anything that cannot be already
      accomplished by the built-in dropdown formatter.

      See:

      http://www.satyam. com.ar/yui/ 2.6.0/assortedCo ntrols.html

      Satyam

      bahalul kabir escribió:

      >
      >
      > Thanx satyam, My search and requery is working fine.
      >
      > How can I write a custom function for dropdown?
      >
      >
      > YAHOO.widget. DataTable. dropdown = function(elLiner, oRecord, oColumn,
      > oData) {
      >
      > (oRecord.getData( "category" )=="support- open"?so= "selected" :so="");
      >
      > (oRecord.getData( "category" )=="support- hold"?sh= "selected" :sh="");
      >
      > elLiner.innerHTML= "<select id=\'supportDropDow n\'>
      > <option
      > value=\'support- open\'"+so+ "> support-open </option>
      >
      <option
      > value=\'support- hold\' "+sh+"> support-hold </option>
      > </select>";
      >
      > };
      >
      > {key:"Category" ,label:"Category ",formatter: YAHOO.widget. DataTable. dropdown, sortable: true},
      >
      > support_dataTable. subscribe( "supportDropDown ",function (oArgs) {
      > alert("hi ydn"); // is not working
      > }
      >
      >
      >
      >
      > ------------ --------- --------- --------- --------- --------- -
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - www.avg.com
      > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date: 11/02/09 20:39:00
      >
      >


    • Satyam
      If you use your own formatter function that event won t be fired, that is why I suggest you use the built-in formatter
      Message 2 of 8 , Nov 3, 2009
      • 0 Attachment
        If you use your own formatter function that event won't be fired, that
        is why I suggest you use the built-in formatter

        bahalul kabir escribió:
        >
        >
        > I tried
        > upport_dataTable.subscribe("dropdownChangeEvent",function (oArgs) {
        > alert("hi"); // it does not work too
        > }
        >
        > ------------------------------------------------------------------------
        > *From:* Satyam <satyam@...>
        > *To:* ydn-javascript@yahoogroups.com
        > *Sent:* Tue, November 3, 2009 2:08:37 PM
        > *Subject:* Re: [ydn-javascript] How can write custom function for
        > dropdown?
        >
        >
        >
        > Nothing in your sample below shows anything that cannot be already
        > accomplished by the built-in dropdown formatter.
        >
        > See:
        >
        > http://www.satyam com.ar/yui/ 2.6.0/assortedCo ntrols.html
        > <http://www.satyam.com.ar/yui/2.6.0/assortedControls.html>
        >
        > Satyam
        >
        > bahalul kabir escribió:
        > >
        > >
        > > Thanx satyam, My search and requery is working fine.
        > >
        > > How can I write a custom function for dropdown?
        > >
        > >
        > > YAHOO.widget. DataTable. dropdown = function(elLiner, oRecord, oColumn,
        > > oData) {
        > >
        > > (oRecord.getData( "category" )=="support- open"?so= "selected" :so="");
        > >
        > > (oRecord.getData( "category" )=="support- hold"?sh= "selected" :sh="");
        > >
        > > elLiner.innerHTML= "<select id=\'supportDropDow n\'>
        > > <option
        > > value=\'support- open\'"+so+ "> support-open </option>
        > > <option
        > > value=\'support- hold\' "+sh+"> support-hold </option>
        > > </select>";
        > >
        > > };
        > >
        > > {key:"Category" ,label:"Category ",formatter: YAHOO.widget.
        > DataTable. dropdown, sortable: true},
        > >
        > > support_dataTable. subscribe( "supportDropDown ",function (oArgs) {
        > > alert("hi ydn"); // is not working
        > > }
        > >
        > >
        > >
        > >
        > > ------------ --------- --------- --------- --------- --------- -
        > >
        > >
        > > No virus found in this incoming message.
        > > Checked by AVG - www.avg.com <http://www.avg.com/>
        > > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date:
        > 11/02/09 20:39:00
        > >
        > >
        >
        >
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - www.avg.com
        > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date: 11/02/09 20:39:00
        >
        >
      • Satyam
        If you state what is it that you need, instead of enumerating random trials you seem to be doing we could make more sense. Satyam
        Message 3 of 8 , Nov 3, 2009
        • 0 Attachment
          If you state what is it that you need, instead of enumerating random
          trials you seem to be doing we could make more sense.

          Satyam

          bahalul kabir escribió:
          >
          >
          > Hi satyam,
          > Ok I wanna do it in cellClickEvent . How can I get the selected
          > value?? As I click on different cell
          > support_dataTable.subscribe("cellClickEvent",function(oArgs) {
          >
          > ar elDropdown = oArgs.target;
          > var oRecord = this.getRecord(elDropdown);
          > selectItem=elDropdown.options[elDropdown.selectedIndex].value;
          > alert(selectItem); // does not work
          >
          > }
          >
          > ------------------------------------------------------------------------
          > *From:* Satyam <satyam@...>
          > *To:* ydn-javascript@yahoogroups.com
          > *Sent:* Tue, November 3, 2009 2:08:37 PM
          > *Subject:* Re: [ydn-javascript] How can write custom function for
          > dropdown?
          >
          >
          >
          > Nothing in your sample below shows anything that cannot be already
          > accomplished by the built-in dropdown formatter.
          >
          > See:
          >
          > http://www.satyam com.ar/yui/ 2.6.0/assortedCo ntrols.html
          > <http://www.satyam.com.ar/yui/2.6.0/assortedControls.html>
          >
          > Satyam
          >
          > bahalul kabir escribió:
          > >
          > >
          > > Thanx satyam, My search and requery is working fine.
          > >
          > > How can I write a custom function for dropdown?
          > >
          > >
          > > YAHOO.widget. DataTable. dropdown = function(elLiner, oRecord, oColumn,
          > > oData) {
          > >
          > > (oRecord.getData( "category" )=="support- open"?so= "selected" :so="");
          > >
          > > (oRecord.getData( "category" )=="support- hold"?sh= "selected" :sh="");
          > >
          > > elLiner.innerHTML= "<select id=\'supportDropDow n\'>
          > > <option
          > > value=\'support- open\'"+so+ "> support-open </option>
          > > <option
          > > value=\'support- hold\' "+sh+"> support-hold </option>
          > > </select>";
          > >
          > > };
          > >
          > > {key:"Category" ,label:"Category ",formatter: YAHOO.widget.
          > DataTable. dropdown, sortable: true},
          > >
          > > support_dataTable. subscribe( "supportDropDown ",function (oArgs) {
          > > alert("hi ydn"); // is not working
          > > }
          > >
          > >
          > >
          > >
          > > ------------ --------- --------- --------- --------- --------- -
          > >
          > >
          > > No virus found in this incoming message.
          > > Checked by AVG - www.avg.com <http://www.avg.com/>
          > > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date:
          > 11/02/09 20:39:00
          > >
          > >
          >
          >
          >
          >
          >
          > ------------------------------------------------------------------------
          >
          >
          > No virus found in this incoming message.
          > Checked by AVG - www.avg.com
          > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date: 11/02/09 20:39:00
          >
          >
        • bahalul kabir
          For example: in dropdown list: support,feature,bug.          and forexample  support is selected as it is from database. But I change the option
          Message 4 of 8 , Nov 3, 2009
          • 0 Attachment
            For example:
            in dropdown list: support,feature,bug.          and forexample  support is selected as it is from database.
            But I change the option to  feature. Now feature is selected. How can I get the changed value(feature) to  my function when I click to click button.

            {key:"category",label:"Category",formatter:"dropdown",dropdownOptions:[],formatter:YAHOO.widget.DataTable.dropdown,sortable:true},
             {key:"move", label:"Move", formatter:YAHOO.widget.DataTable.formatButton},
             
            support_dataTable.subscribe("cellClickEvent",function(oArgs) {
             
                  if(column.key == "move")
                {
                   
                     var elDropdown = oArgs.target;        
                     var oRecord = this.getRecord(elDropdown);
                      alert(oRecord.setData("category",elDropdown.options[elDropdown.selectedIndex].value));  // not working
                       }
            });


            From: Satyam <satyam@...>
            To: ydn-javascript@yahoogroups.com
            Sent: Tue, November 3, 2009 3:20:45 PM
            Subject: Re: [ydn-javascript] How can write custom function for dropdown?

             

            If you state what is it that you need, instead of enumerating random
            trials you seem to be doing we could make more sense.

            Satyam

            bahalul kabir escribió:

            >
            >
            > Hi satyam,
            > Ok I wanna do it in cellClickEvent . How can I get the selected
            > value?? As I click on different cell
            > support_dataTable. subscribe( "cellClickEvent" ,function( oArgs) {
            >
            > ar elDropdown = oArgs.target;
            > var oRecord = this.getRecord( elDropdown) ;
            > selectItem=elDropdo wn.options[ elDropdown. selectedIndex] .value;
            > alert(selectItem) ; // does not work
            >
            > }
            >
            > ------------ --------- --------- --------- --------- --------- -
            > *From:* Satyam <satyam@satyam. com.ar>
            > *To:*
            target=_blank ymailto="mailto:ydn-javascript%40yahoogroups.com">ydn-javascript@ yahoogroups. com
            > *Sent:* Tue, November 3, 2009 2:08:37 PM
            > *Subject:* Re: [ydn-javascript] How can write custom function for
            > dropdown?
            >
            >
            >
            > Nothing in your sample below shows anything that cannot be already
            > accomplished by the built-in dropdown formatter.
            >
            > See:
            >
            > http://www.satyam. com.ar/yui/ 2.6.0/assortedCo ntrols.html
            > <http://www.satyam. com.ar/yui/ 2.6.0/assortedCo ntrols.html>
            >
            > Satyam
            >
            > bahalul kabir escribió:
            > >
            > >
            > > Thanx satyam, My search and requery is working fine.
            > >
            > > How can I write a custom function for dropdown?
            > >
            > >
            > > YAHOO.widget. DataTable. dropdown = function(elLiner, oRecord, oColumn,
            > > oData) {
            > >
            > > (oRecord.getData( "category" )=="support- open"?so= "selected" :so="");
            > >
            > > (oRecord.getData( "category" )=="support- hold"?sh= "selected" :sh="");
            > >
            > > elLiner.innerHTML= "<select id=\'supportDropDow n\'>
            > > <option
            > > value=\'support- open\'"+so+ "> support-open </option>
            > > <option
            > > value=\'support- hold\' "+sh+"> support-hold </option>
            > > </select>";
            > >
            > > };
            > >
            > > {key:"Category" ,label:"Category ",formatter: YAHOO.widget.
            > DataTable. dropdown, sortable: true},
            > >
            > > support_dataTable. subscribe( "supportDropDown ",function (oArgs) {
            > > alert("hi ydn"); // is not working
            > > }
            > >
            > >
            > >
            > >
            > > ------------ --------- --------- --------- --------- --------- -
            > >
            > >
            > > No virus found in this incoming message.
            > > Checked by AVG - www.avg.com <http://www.avg. com/>
            > > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date:
            > 11/02/09 20:39:00
            > >
            > >
            >
            >
            >
            >
            >
            > ------------ --------- --------- --------- --------- --------- -
            >
            >
            > No virus found in this incoming message.
            > Checked by AVG - www.avg.com
            > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date: 11/02/09 20:39:00
            >
            >


          • Satyam
            Ok, I think I understand. All values for the DataTable come from the Recordset and any changes should go there as well so, you should add the category
            Message 5 of 8 , Nov 3, 2009
            • 0 Attachment
              Ok, I think I understand.

              All values for the DataTable come from the Recordset and any changes
              should go there as well so, you should add the "category" dropdown using
              the standard dropdown and setting the dropdown options to reflect the
              three possible states: support, feature and bug. If the database
              contains other values to encode those options then you should use an
              array of label, value objects:

              dropdownOptions:['support','feature','bug']

              or

              dropdownOptions:[{label:'support',value:1},{label:'feature',value:2},{label:'bug',value:3}]

              whichever is the case. Then, to update the record when the dropdown
              selection is changed:

              myDataTable.on('dropdownChangeEvent',function (oArgs) {
              var target = oArgs.target,
              column = this.getColumn(target),
              record = this.getRecord(target);

              record.setData(column.key, target .options[target
              .selectedIndex].value);
              });

              Then, from anywhere else, you can read the value of the dropdown by
              checking the Record object for that column:

              record.getData('category');

              since the dropdown will always keep it updated.

              Satyam



              bahalul kabir escribió:
              >
              >
              > For example:
              > in dropdown list: support,feature,bug. and forexample
              > support is selected as it is from database.
              > But I change the option to feature. Now feature is selected. How can
              > I get the changed value(feature) to my function when I click to click
              > button.
              >
              > {key:"category",label:"Category",formatter:"dropdown",dropdownOptions:[],formatter:YAHOO.widget.DataTable.dropdown,sortable:true},
              > {key:"move", label:"Move",
              > formatter:YAHOO.widget.DataTable.formatButton},
              >
              > support_dataTable.subscribe("cellClickEvent",function(oArgs) {
              >
              > if(column.key == "move")
              > {
              >
              > var elDropdown = oArgs.target;
              > var oRecord = this.getRecord(elDropdown);
              >
              > alert(oRecord.setData("category",elDropdown.options[elDropdown.selectedIndex].value));
              > // not working
              > }
              > });
              >
              > ------------------------------------------------------------------------
              > *From:* Satyam <satyam@...>
              > *To:* ydn-javascript@yahoogroups.com
              > *Sent:* Tue, November 3, 2009 3:20:45 PM
              > *Subject:* Re: [ydn-javascript] How can write custom function for
              > dropdown?
              >
              >
              >
              > If you state what is it that you need, instead of enumerating random
              > trials you seem to be doing we could make more sense.
              >
              > Satyam
              >
              > bahalul kabir escribió:
              > >
              > >
              > > Hi satyam,
              > > Ok I wanna do it in cellClickEvent . How can I get the selected
              > > value?? As I click on different cell
              > > support_dataTable. subscribe( "cellClickEvent" ,function( oArgs) {
              > >
              > > ar elDropdown = oArgs.target;
              > > var oRecord = this.getRecord( elDropdown) ;
              > > selectItem=elDropdo wn.options[ elDropdown. selectedIndex] .value;
              > > alert(selectItem) ; // does not work
              > >
              > > }
              > >
              > > ------------ --------- --------- --------- --------- --------- -
              > > *From:* Satyam <satyam@satyam. com.ar <mailto:satyam%40satyam.com.ar>>
              > > *To:* ydn-javascript@ yahoogroups. com
              > <mailto:ydn-javascript%40yahoogroups.com>
              > > *Sent:* Tue, November 3, 2009 2:08:37 PM
              > > *Subject:* Re: [ydn-javascript] How can write custom function for
              > > dropdown?
              > >
              > >
              > >
              > > Nothing in your sample below shows anything that cannot be already
              > > accomplished by the built-in dropdown formatter.
              > >
              > > See:
              > >
              > > http://www.satyam com.ar/yui/ <http://com.ar/yui/> 2.6.0/assortedCo
              > ntrols.html
              > > <http://www.satyam com.ar/yui/ 2.6.0/assortedCo ntrols.html
              > <http://www.satyam.com.ar/yui/2.6.0/assortedControls.html>>
              > >
              > > Satyam
              > >
              > > bahalul kabir escribió:
              > > >
              > > >
              > > > Thanx satyam, My search and requery is working fine.
              > > >
              > > > How can I write a custom function for dropdown?
              > > >
              > > >
              > > > YAHOO.widget. DataTable. dropdown = function(elLiner, oRecord,
              > oColumn,
              > > > oData) {
              > > >
              > > > (oRecord.getData( "category" )=="support- open"?so= "selected"
              > :so="");
              > > >
              > > > (oRecord.getData( "category" )=="support- hold"?sh= "selected"
              > :sh="");
              > > >
              > > > elLiner.innerHTML= "<select id=\'supportDropDow n\'>
              > > > <option
              > > > value=\'support- open\'"+so+ "> support-open </option>
              > > > <option
              > > > value=\'support- hold\' "+sh+"> support-hold </option>
              > > > </select>";
              > > >
              > > > };
              > > >
              > > > {key:"Category" ,label:"Category ",formatter: YAHOO.widget.
              > > DataTable. dropdown, sortable: true},
              > > >
              > > > support_dataTable. subscribe( "supportDropDown ",function (oArgs) {
              > > > alert("hi ydn"); // is not working
              > > > }
              > > >
              > > >
              > > >
              > > >
              > > > ------------ --------- --------- --------- --------- --------- -
              > > >
              > > >
              > > > No virus found in this incoming message.
              > > > Checked by AVG - www.avg.com <http://www.avg.com/>
              > <http://www.avg com/ <http://www.avg.com/>>
              > > > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date:
              > > 11/02/09 20:39:00
              > > >
              > > >
              > >
              > >
              > >
              > >
              > >
              > > ------------ --------- --------- --------- --------- --------- -
              > >
              > >
              > > No virus found in this incoming message.
              > > Checked by AVG - www.avg.com
              > > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date:
              > 11/02/09 20:39:00
              > >
              > >
              >
              >
              >
              >
              >
              > ------------------------------------------------------------------------
              >
              >
              > No virus found in this incoming message.
              > Checked by AVG - www.avg.com
              > Version: 9.0.698 / Virus Database: 270.14.46/2477 - Release Date: 11/02/09 20:39:00
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.