如何获得扩展的行列值onHierarchyExpanded在radgrid
本文关键字:onHierarchyExpanded radgrid 何获得 扩展 | 更新日期: 2023-09-27 18:12:03
我有一个radgrid如下:
<telerik:RadGrid ID="ProductRanges_Grd" ShowHeaderWhenEmpty="true" runat="server"
AutoGenerateColumns="false" Width="100%" Height="250px" ShowHeader="true" Visible="false"
OnDetailTableDataBind="ProductRanges_Grd_DetailTableDataBind" OnItemCommand="ProductRanges_Grd_ItemCommand"
OnInsertCommand="ProductRanges_Grd_InsertCommand" OnUpdateCommand="ProductRanges_Grd_UpdateCommand"
OnNeedDataSource="ProductRanges_Grd_NeedDataSource" OnDeleteCommand="ProductRanges_Grd_DeleteCommand"
OnItemDataBound="ProductRanges_Grd_ItemDataBound" >
<ClientSettings>
<ClientEvents OnRowSelected="RowSelected" OnHierarchyExpanded="HierarchyExpanded" />
<Scrolling AllowScroll="true" />
<Selecting AllowRowSelect="true" />
</ClientSettings>
<MasterTableView EditMode="EditForms" HierarchyLoadMode="Client" DataKeyNames="PROVIDER_ID,PROVIDER_NAME"
HierarchyDefaultExpanded="false">
<NoRecordsTemplate>
<span></span>
</NoRecordsTemplate>
<Columns>
<telerik:GridBoundColumn UniqueName="PROVIDER_ID" DataField="PROVIDER_ID" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="PROVIDER_NAME" DataField="PROVIDER_NAME" HeaderText="Provider">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView CommandItemDisplay="Top" DataKeyNames="PRODUCT_ID" Name="ProductTableView"
ShowHeadersWhenNoRecords="true" EditMode="EditForms" ShowFooter="true" >
<CommandItemTemplate>
<table width="100%">
<tr>
<td align="left" style="padding-left: 8px;" valign="middle">
<asp:ImageButton ID="AddDetailTable_btn" CommandName="InitInsert" runat="server"
ImageUrl="~/images/add.gif" /> Add
</td>
</tr>
</table>
</CommandItemTemplate>
<Columns>
<telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="../../../images/Erase12.png"
HeaderText="Remove" CommandName="Delete">
</telerik:GridButtonColumn>
<telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../../../images/edit.gif">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn UniqueName="ROW_ID" DataField="ROW_ID" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="PRODUCT_ID" DataField="PRODUCT_ID" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="PRODUCT_NAME" DataField="PRODUCT_NAME" HeaderText="Products">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Min_Quantity" DataField="MIN_QUANTITY" HeaderText="Minimum quantity">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Max_Quantity" DataField="MAX_QUANTITY" HeaderText="Maximum quantity">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Comission" DataField="DISCOUNT_VALUE"
HeaderText="Comission">
</telerik:GridBoundColumn>
<script type="text/javascript">
function HierarchyExpanded(sender,args)
{
// how can i get the expended row ProviderID in here
}
感谢您的帮助
请尝试使用下面的代码片段。
JS
function HierarchyExpanded(sender, args) {
alert(args.get_gridDataItem().getDataKeyValue("PROVIDER_ID"));
}
是
<MasterTableView ClientDataKeyNames="PROVIDER_ID" HierarchyLoadMode="Client">