Welcome Guest Search | Active Topics | Sign In | Register

Grid - Dropdown Options
Vinny
Posted: Wednesday, July 23, 2008 11:22:36 AM
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
eo_support
Posted: Wednesday, July 23, 2008 11:31:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
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
Vinny
Posted: Wednesday, July 23, 2008 11:36:35 AM
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
eo_support
Posted: Wednesday, July 23, 2008 11:56:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
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
Vinny
Posted: Wednesday, July 23, 2008 12:03:19 PM
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
eo_support
Posted: Wednesday, July 23, 2008 12:09:53 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
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.html

Thanks
Vinny
Posted: Wednesday, July 23, 2008 7:38:18 PM
Rank: Advanced Member
Groups: Member

Joined: 7/21/2008
Posts: 90
Hi, Thanks a ton...

Its now working....

Vinny
eo_support
Posted: Thursday, July 24, 2008 7:25:19 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
Excellent. Thanks for letting us know!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.