Hello:
Does documentation exist where I could find the appropriate javascript functions to use to access values in individual cell items of a currently selected row? I have created a JS event handler to handle the RowSelectionChanging event on the client side. I have successfully enabled Intellisense by adding a webscript manager and temporarily removing the reference to the master page. However, when I assign a variable the collection returned by getCurrentSelectedRows(), no methods appear for this variable under intellisense. Does a function such as get_item or get_cell exist in this collection? Even more specifically the values I must access are values inside textboxes that sit on top of the cell. I know that on the server side "FindControl" can be used.
In the end, my goal is to handle this event, access the values from each textbox of the row and then send a manual AJAX request to update the database with these values.
Any input would be much appreciated. Below is my javascript function. It is very simple because I have not been able to proceed beyond this point as I don't know which functions to use to access cell items.
Thank you,
gridRowSelectionChanging(sender, e) {
///<summary>
///
///</summary>
///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param>
///<param name="e" type="Infragistics.Web.UI.RowSelectionChangingEventArgs"></param>
//Returns a Read Only collection of the currently selected rows
currentSelectedRows = e.getCurrentSelectedRows();
Also, I tried the following:
function
///<summary>//////</summary>///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param>///<param name="e" type="Infragistics.Web.UI.RowSelectionChangingEventArgs"></param>//Returns a Read Only collection of the currently selected rows
var currentSelectedRows = e.getCurrentSelectedRows();
if (currentSelectedRows.get_length() == 1) {
alert(currentSelectedRows.get_Item(0));
}
But I receive a JS error stating “Object doesn’t support this property or method.”
Thanks,
I also tried the following:
currentSelectedRows.get_Item(0);
currentSelectedRows.getItem(0);
currentSelectedRows.get_item(0);
currentSelectedRows.Item(0);
I still get the same error "Object doesn't support this property or method."
Okay – I am able to access the text and values of the cells as indicated in the function below.
But I still need to be able to access the values of the textboxes that are sitting on top of the cells. Is this possible to do?
Thanks!
function gridRowSelectionChanging(sender, e) {
alert(e.getCurrentSelectedRows().getRow(0).get_cell(100).get_text());
I am trying to replicate your illustration in my web application without success. In the following jscript, I see the UserSelectingDealer alert but the number of rows selected is zero.
function UserSelectingDealer(sender, e) { alert("We are in UserSelectingDealer"); var wkCurrentSelectedRows = e.getCurrentSelectedRows(); var wkSelectedRowsLength = wkCurrentSelectedRows.get_length(); alert("Selecting: UserSelectingDealer " + wkSelectedRowsLength); if (e.getCurrentSelectedRows().get_length() == 1) { alert(e.getCurrentSelectedRows().getRow(0).get_cell(0).get_text()); } }
The following is my WebDataGrid in my aspx page. The code behind builds the grids data source and adds the bound columns to the webdatagrid.
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="1200px"> <Behaviors> <ig:Activation Enabled="true" /> <ig:Selection RowSelectType="Single" Enabled="true" CellClickAction="Row" SelectionClientEvents-RowSelectionChanged="UserSelectedDealer" SelectionClientEvents-RowSelectionChanging="UserSelectingDealer"> </ig:Selection> <ig:RowSelectors RowNumbering="true" Enabled="true"> <RowSelectorClientEvents RowSelectorClicking="UserSelectingDealer" RowSelectorClicked="UserSelectingDealer" /> </ig:RowSelectors> <ig:Paging PagerAppearance="Bottom" PageSize="10" Enabled="true" /> </Behaviors> </ig:WebDataGrid>
The display of the grid is good. I just cannot get the KeyValue of the row selected in either the jscript or the code behind.
Thanks for your help in advance.
Dev__01
Nice to hear that I am able to help.
Issue Solved:
Thank you to Rado Minchev in the following post: http://forums.infragistics.com/forums/p/45276/245350.aspx
To anyone interested, here is the fully working function to access the cell items via BLOCKED SCRIPT
function gridRowSelectionChanging(sender, e)
{
if (e.getCurrentSelectedRows().get_length() == 1)
alert(e.getCurrentSelectedRows().getRow(0).get_cell(90).get_element().children[3].value);
Now the only part left is to write the manual AJAX to send the values to the server for database update.
Thanks Rado!