|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
Hi,
I've implemented the code for "Custom Column Advanced 2 demo". When dropdown loads it shows the text but when I change the dropdown's item then text is not coming in the grid. However it only shows the value. As per "on_end_edit(cell)" function it returns the value.
I was looking on changing the dropdown item to have text in Grid and value underneath so that I can send the value to database.
In the following javascript function its returning the value. function on_end_edit(cell) { //Get the new value from the drop down box var dropDownBox = document.getElementById("product_dropdown"); var selectedIndex = dropDownBox.selectedIndex; if (selectedIndex > 0) return dropDownBox.options[selectedIndex].value;
return null; }
Thanks,
Vinny
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
The code you pasted looks correct. As once again, can you put together a full test page? Once we have the full page we should be able to run it and tell you what's wrong.
Since we will not be able to use your datasource, there is no need for you to include any code that access/update your datasource. We usually use fake object data source and use break points to verify the value in the debugger.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
I'll do a test page. However, I was wondering if the following in the function
return dropDownBox.options[selectedIndex].value;
is returning .value then the grid would value instead of text. Then how the text be visible?
Vinny
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
In this particular sample, the Grid never held the drop down item text. It holds the drop down item value (When the code fills the drop down, it fills both item text and item value). For example, if you select "HP #94 Black ink cartridge" from the drop down, you will end up with "C8765WA", instead of "HP #94 Black ink cartridge" in the Grid. In another word, the Grid takes whatever you return.
Hope this helps.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
Hi,
So, it is not possible to show text on changing the dropdown's item and actually sends its value to the database?
Vinny
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Vinny wrote:So, it is not possible to show text on changing the dropdown's item and actually sends its value to the database? That is not correct. The key at here is: 1. The Grid only holds one value per cell for you. How to use/intepret that value is totally up to you; 2. What you show to the user can be different than the underlying value. This applies to both displaying and editing; When you use a dropdown, you are dealing with the editing part. The displaying part supports similar mechanism: http://www.essentialobjects.com/ViewDoc.aspx?t=Grid%2fcustom_column.htmlThanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
Hi, Thanks a ton...
Its now working....
Vinny
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Excellent. Thanks for letting us know!
|
|