| Page 1 of 1 | [ 9 posts ] |
|
Hello,
I have a DataTable with two dropdownCellEditors with the dropdownOptions populated and I am able to do that. Both the dropdowns have the same value but the labels are different. And when I select first dropdown label, I want to set the second dropdown with the same value and show the dropdown label selected. For this, I am trying to set the value in the asyncSubmitter function of the first dropdown like below. rec.setData("FirstDropdown", newValue ); rec.setData("SecondDropdown", newValue); DataTable.render(); But the issue is when I select a value from first dropdown, the second dropdown is showing the value but not the label. How can I set the value and show the label for the second dropdown in the asyncSubmitter function of the first dropdown if the first dropdown label is selected. Please let me know. Thanks |
|
Can some one please help me how to get the focus for the dropdownCellEditor?
And how can I make the second dropdownCellEditor show the label when the first dropdownCellEditor is selected. It should work as onchange event in javascript. |
|
I am trying to use either the blurEvent or the dropdownChangeEvent as below
editor.subscribe("blurEvent", function(oArgs) { } this.myDataTable.subscribe("dropdownChangeEvent", function(oArgs){ var elDropdown = oArgs.target; var oRecord = this.getRecord(elDropdown); oRecord.setData("SD_Id",elDropdown.options[elDropdown.selectedIndex].value); }); but I noticed that both the events are not occuring. Moreover I am able to set the value but how can I show the label associated to that value in the second drop down. |
|
Recommend you look at a similar topic at http://yuilibrary.com/forum/viewtopic.php?p=26557#p26557.
Another recent posting is http://yuilibrary.com/forum/viewtopic.php?f=90&t=7946. Part of the problem may be related to whether you are using a dropdown "formatter" versus a dropdown "editor". We can't know this without seeing the column definitions and other items. I suggest you post a pastie link to a listing of your code so that we can review the whole thing and provide better suggestions. Todd |
|
|
|
Would you like the DataTable to display the "dropdown" box for both controls ALL the time, or only when the user is editing? This makes a big difference on whether you use a dropdown "formatter" or a dropdown "editor".
For example, in my apps I usually don't show the dropdown box on the basic display table ... people have a bad habit of clicking on dropdowns randomly (because they are cool) when I may not want them to. So my usual preference is to show the dropdown value (or label) in the column and only to display the dropdown combo-box when the user intends to change it ... via listening to cellDblclickEvent. Then I show the cell editor once the user dbl-clicks. If this is the same method you want, then I would suggest using custom formatters that just display a static label in the column (based upon the dropdownOptions) AND also using custom dropdown editors on those columns initiated by cellDblClickEvent. It really depends on what your design intent is for your DataTable display. |
|
Hi Todd,
If possible, I really like to display the "dropdown" box for both the controls ALL the time and I want to show the second dropdown label selected when the first dropdown label/value is changed or vice versa as both the dropdowns will have the same value with different labels. Can you please provide me an example if I have to use the editor with the cellDblclickEvent. Thank you |
|
Not quite sure if I understand what you want to do here, I am confused why you have two columns based on the same datasource value.
If you want to show the "dropdown" ALL the time then I suggest you use a dropdown Formatter, because it show all the time and a dropdown Editor only shows when the editor is invoked (like cellClick or cellDblclick). You can only subscribe to the "dropdownChangeEvent" by using a dropdown Formatter or your own formatter that makes an HTML select element but not using a dropdown Editor ! The function you define when subscribing (see http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#event_dropdownChangeEvent) can update the cell values in a similar fashion to a cell editor. If you are using remote data you can't use the asyncSubmitter but can make a .sendRequest or Ajax to update the remote data within this subscribed function. I created a simple jsFiddle link http://jsfiddle.net/PKsdR/2/ that includes an example of how to hookup a dropdown formatter to a table and subscribe to the dropdownChange event. When the dropdown is changed, it updates the values of three other columns based upon what was selected. Since I can't really figure out what you are trying to do, all of these links in this posting an my prior responses should be more than enough to show you one way of doing this. Take care, Todd |
|
Thank you todd for your help.
It is working if I give the formatter instead of editor. Thanks again. |
| Page 1 of 1 | [ 9 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group