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 found a way to do this, but I don't know if there's another approach to this.
I have a Grid with a DropdownList column (not WebCombo) and I need to swap the datasource for that column when adding a new row. Existing records need to display their corresponding text from the assigned datasource, but when adding I need the dropdown to point to another datasource... or simply use another dropdown editor hidden on the form.
Basically, every entry on the datasource can be displayed for that column, but only a few may be added (based on permissions, etc). I'm doing this with the OnEnterEditMode method:
function webGridBeta_OnEnterEditMode(controlId, tblName, editObject) { if (editObject.ToCellObject().Name == "Status") { debugger; var editObj = editObject.element.value; var options = editObject.element.getElementsByTagName('option'); var optionsLength = editObject.element.getElementsByTagName('option').length; optionsBackup = options; var ddlTemp = $get('<%=ddlStatusSwap.ClientID%>'); var ddlOptions = ddlTemp.getElementsByTagName('option'); var ddlOptionsLength = ddlTemp.getElementsByTagName('option').length; editObject.element.removeChild(options[2]); editObject.element.removeChild(options[1]); editObject.element.removeChild(options[0]); editObject.element.appendChild(ddlOptions[1]); editObject.element.appendChild(ddlOptions[0]); } }
This ddlStatusSwap is being populated on Page_Load and I'm just moving its <Option> nodes to the dropdown the grid generates as I purge the "old" ones.
Is there a more efficient approach?
For your scenario, my suggestion would be inline with your solution. We must manually remove and add the new option during OnEnterEditMode client side event handler.
On the other hand, if you are using WebCombo, you could try using SetAdditionalFilter method to filter the data based on certain criteria as detailed in the WebCombo documentaion on article titled "How-to: Filter the data in WebCombo using SetAdditionalFilter method"
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