Good afternoon,
I have a grid with the following layout:
and then the following JavaScript
Everything works fine !
However, when I try to obtain the value of "CashOnDeliveryAmount" ( UniqueName ) or "cod_Amount" ( DataField ) I always get "null".
What I am trying to do is to create a total based on the selectedRows that is displayed somewhere else on the page.
I seem not to be able to find anything similar in the examples or in the forums ( which obviously does not mean that there isn't ).
Any help would be appreciated.
SR
I have a grid with the following layout:
<telerik:RadGrid ID="o_Results" runat="server" Width="938px" AllowMultiRowSelection="True" EnableViewState="True"> <ClientSettings> <ClientEvents OnRowDeselected="SelectionChanged" OnRowSelected="SelectionChanged" /> <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="144px" /> <Selecting AllowRowSelect="True" /> </ClientSettings> <MasterTableView DataKeyNames="cod_GUID,mov_GUID" AutoGenerateColumns="false"> <Columns> <telerik:GridBoundColumn DataField="cod_GUID" Visible="False" HeaderText="CashOnDeliveryID" UniqueName="CashOnDeliveryID"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="mov_GUID" Visible="False" HeaderText="MovementID" UniqueName="MovementID"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="str_CodCompany" Visible="True" HeaderText="Azienda"> <HeaderStyle Width="80px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="car_Code" Visible="True" HeaderText="Corriere"> <HeaderStyle Width="80px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="mov_RunningNumber" Visible="True" HeaderText="TV2"> <HeaderStyle Width="50px" /> <ItemStyle HorizontalAlign="Right" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="str_MoveNumber" Visible="True" HeaderText="DDT"> <HeaderStyle Width="50px" /> <ItemStyle HorizontalAlign="Right" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="dte_InsertDate" Visible="True" HeaderText="Data DDT" DataFormatString="{0:dd/MM/yyy HH:mm}" DataType="System.DateTime"> <HeaderStyle Width="100px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="cod_Amount" Visible="True" HeaderText="Valore" DataFormatString="{0:C2}" DataType="System.Double" UniqueName="CashOnDeliveryAmount"> <HeaderStyle Width="60px" /> <ItemStyle HorizontalAlign="Right" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="mov_SimpleAddress" Visible="True" HeaderText="Indirizzo"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ch8_CallCode" Visible="True" HeaderText="DDT"> <HeaderStyle Width="60px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="cos_Code" Visible="True" HeaderText="CoD"> <HeaderStyle Width="60px" /> </telerik:GridBoundColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn> </EditFormSettings> </MasterTableView> <FilterMenu EnableImageSprites="False"></FilterMenu></telerik:RadGrid>and then the following JavaScript
<script type="text/javascript" id="telerikClientEvents1"> //<![CDATA[ function SelectionChanged(sender, args) { var grid = $telerik.findGrid("<%= o_Results.ClientID %>"); grid = $telerik.toGrid(grid); var masterTable = grid.get_masterTableView(); var selectedRows = masterTable.get_selectedItems(); for (var i = 0; i < selectedRows.length; i++) { var row = selectedRows[i]; // var rowIndex = row.get_itemIndexHierarchical(); // console.log("get_itemIndexHierarchical() = " + index); var amount = row.get_dataItem("CashOnDeliveryAmount"); console.log(amount); } } //]]></script>Everything works fine !
However, when I try to obtain the value of "CashOnDeliveryAmount" ( UniqueName ) or "cod_Amount" ( DataField ) I always get "null".
What I am trying to do is to create a total based on the selectedRows that is displayed somewhere else on the page.
I seem not to be able to find anything similar in the examples or in the forums ( which obviously does not mean that there isn't ).
Any help would be appreciated.
SR