I have a cascading dropdown scenario in the webdatagrid. In order to populate the second dropdown, I need to value of the selecteditem in the first dropdown. The following javascript firest on the CellEditing_EnteredEditMode event and gives me a value, but the value does not appear to be for the dropdown on the correct row.
if (args._editor._id.indexOf("ddlTeams") > -1) { var editorID = sender._editorProviders._items[1]._editor._id; var val = getWDDLValue(editorID); args._editor.loadItems(val); }
function getWDDLValue(wddlID) { var wddl = $find(wddlID); var item = wddl.get_items().getItem(wddl.get_selectedItemIndex()); if (item != null) { return item.get_value(); } else { return null; } }
I need the value, not the text since the query that populates the second dropdown requires it.
Any help appreciated!
-Lee
Hello Lee,
the following javascript should return the provider's value:
function WebDataGrid1_Editing_CellValueChanged(sender, eventArgs){ ///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.CellValueChangedEventArgs"></param> //Add code to handle your event here. var value = eventArgs.get_cell().get_value(); alert(value);}
function WebDataGrid1_Editing_CellValueChanged(sender, eventArgs){ ///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.CellValueChangedEventArgs"></param>
//Add code to handle your event here.
var value = eventArgs.get_cell().get_value(); alert(value);}
Also you will have to specify DataKeyFields and ValueField for the WebDropDownProvider:
<ig:DropDownProvider ID="WebDataGrid1_DropDownProvider1"> <EditorControl ClientIDMode="Predictable" DataSourceID="SqlDataCategories" DataKeyFields="CategoryID" ValueField="CategoryID" TextField="CategoryName" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False"> <DropDownItemBinding TextField="CategoryName" ValueField="CategoryID"></DropDownItemBinding> <ClientEvents ValueChanged="ValueChanged" /> </EditorControl> </ig:DropDownProvider>
Please let me know if this is working for you
Hi Hristo,
Unfortunately, that doesn't work for me. I need to fill the second dropdown even if the first dropdown's value has not changed, therefore I'm using the CellEditing_EnteredEditMode event.
Here's the code
function grdUsers_CellEditing_EnteredEditMode(sender, args) { var curRow = curCell.get_row(); if (args._editor._id.indexOf("ddlTeams") > -1) { var groupID = curRow.get_cellByColumnKey("BusUnit").get_value(); args._editor.loadItems(groupID.toString()); } }
No matter how I go about it, the get_value method of the cell containing the 1st dropdown always returns the Text of the cell, not the value it represents. I'm thinking at this point I'll have to add a hidden column that will contain that value. I'm not too thrilled about that solution though. Am I missing something?
Here's the markup of the editorproviders:
<EditorProviders> <ig:DropDownProvider ID="grdUsers_ddlRoles"> <EditorControl ID="ddlRoles" ClientIDMode="Predictable" DataKeyFields="EUERoleID" DisplayMode="DropDownList" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" > </EditorControl> </ig:DropDownProvider> <ig:DropDownProvider ID="grdUsers_ddlGroups"> <EditorControl ID="ddlGroups" ClientIDMode="Predictable" DataKeyFields="EUEGroupID" DisplayMode="DropDownList" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" TextField="DisplayGroupName" DataSourceID="ldsGroups" ValueField="EUEGroupID"> <DropDownItemBinding TextField="DisplayGroupName" ValueField="EUEGroupID" /> </EditorControl> </ig:DropDownProvider> <ig:DropDownProvider ID="grdUsers_ddlTeams"> <EditorControl ID="ddlTeams" ClientIDMode="Predictable" DataKeyFields="TeamID" DisplayMode="DropDownList" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" TextField="TeamName" ValueField="TeamID" OnItemsRequested="wddlTeams_ItemsRequested"> <DropDownItemBinding TextField="TeamName" ValueField="TeamID" /> </EditorControl> </ig:DropDownProvider> </EditorProviders>
It' s the second and third providers that I'm working with in the scenario, where the3rd is dependent upon the 2nd.
Thanks!
Lee
Este framework de Ingragistics es un asco, se pierden horas buscando soluciones y al final no se encuentran. Como el enlace que se describe arriba, no lleva a ningun lado util. Desgraciadamente en la empresa donde trabajo usan estos inutiles componentes. La documentación es muy parcial, no entiendo como sobreviven en el mundo comercial con estos productos.
Hi Lee,
Please check this out: http://news.infragistics.com/forums/p/45774/248098.aspxThis is the same scenario and there is a sample.
Hope this helps