iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi. I have bound Parent and Child combos. After I select a new value in Parent combo, I open Child combo and its new values are populated - what I need. I also need to programmatically display the 1st row in Child combo. I tried to use SetSelectedIndex(0):
var combo = ISGetObject("WebCombo1");
combo.SetSelectedIndex(0);
but it doesn’t work, because “combo” has no rows (values are populated only after I manually open drop down). How to solve the problem?
If I use:
combo.SetText(“…”);
combo.LoadValue();
only one value is loaded when I open the combo.
Thanks.
Hello Ellen,
I have a workaround to implement SetSelectedIndex() by using the following code:
function wcCategory_OnAfterItemSelected(controlId) { var wcCategory = ISGetObject(controlId); var wcProduct = ISGetObject("wcProduct"); wcProduct.SetFocus(); wcProduct.ShowDropDown(); window.setTimeout(function () { wcProduct.SetSelectedIndex(0); }, 650); return true; }
The data in combo will not be populated before you open the dropdown. Therefore, this code works fine but it will let the dropdown opened. This is the workaround I found so far.
Attached is the sample file for your reference. Hope this helps.
Thank you.
I believe you have to use linked combo in your scenario.
You can still use SetText() and LoadValue() method. However, in order to display all values when you open the combo, you need to turn off the query handler. In LinkSettings, you need to set SkipQueryTextField to True.
<LinkSettings Enabled="True" ParentWebComboID="wcCategory" SkipQueryTextField="True" />
By disabling this property, you will get all values when you open the combo.
Hope this helps.
Martin,
Thank you for replying.
Is it possible to use combo.SetSelectedIndex(0) instead of SetText()?
Is there a simple way to select the first row?
Thanks, Ellen.
Hi Martin,
I tried the code (“var wcCategory = ISGetObject(controlId)” is not used) and it has the same problem that I have been struggling with:
“wcProduct.ShowDropDown();” doesn’t open dropdown, it only shows DropDown symbol (as said in the Reference). The element Rows of wcProduct is still null and no row can be selected.
Thank you,
Ellen
Have you tried the attached sample provided in the previous post?
In the sample, I'm using Category and Product tables. The controlID is basically the id of the 1st combo, which is wcCategory based on the sample.
The sample works fine and the dropdown does open. You need to set focus to the combo before you open the dropdown. In my code, I'm using SetFocus() and ShowDropDown() methods.
I have attached a short flash video that shows the result when I run the sample.
I solved the problem. The error message was "Microsoft JScript runtime error: '_attrInit' is null or not an object". The reason was setting Timeout to 650, what was not enough. After I set it to 2000, everything started working fine.
Thank you, Ellen
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname