Hello everyone.
I am writing about a problem item "expanded and collapsed". I created a button that will "expand" or "collapsed" my items according to their status by calling a simple javascript function .
(If the item is expanded ==> item equal collapse and if the item is collapsed ==> item equal expanded).
Almost everything works perfectly. but I do not know why there is always an item at the top of my grid is always "extended". But when I debug my javascript function, I can see that my loop, foreach well on all items.
Here is my javascript code that allows me to expand or hide items based on their condition.
And my RadGrid code Asp:
I am writing about a problem item "expanded and collapsed". I created a button that will "expand" or "collapsed" my items according to their status by calling a simple javascript function .
(If the item is expanded ==> item equal collapse and if the item is collapsed ==> item equal expanded).
Almost everything works perfectly. but I do not know why there is always an item at the top of my grid is always "extended". But when I debug my javascript function, I can see that my loop, foreach well on all items.
Here is my javascript code that allows me to expand or hide items based on their condition.
function expandCollpaseAllIncident() { var Grid = $find("<%= RadGridToolIncident.ClientID %>"); var MasterTable = Grid.get_masterTableView(); for (var i = 0; i < MasterTable.get_dataItems().length; i++) { var row = MasterTable.get_dataItems()[i]; if (row.get_expanded() == false) { row.set_expanded(true); } else { row.set_expanded(false); } } }And my RadGrid code Asp:
<telerik:RadGrid ShowHeader="false" ID="RadGridToolIncident" runat="server" DataSourceID="SqlDataSourceAllIncidents" OnItemDataBound="RadGridToolIncident_ItemDataBound" AutoGenerateColumns="false" EnableEmbeddedSkins="false" CssClass="gridIncident_pilotageGeneral"> <MasterTableView runat="server" DataSourceID="SqlDataSourceAllIncidents" DataKeyNames="toolsID" CssClass="tableBlockPilotageIncident" Width="196px" > <NoRecordsTemplate> <asp:Label runat="server" ID="lbNoRecorsTool" Text='<%$ Resources:IRM, tool_action_label_no_current %>'></asp:Label> </NoRecordsTemplate> <Columns> <telerik:GridTemplateColumn UniqueName="toolsID" Visible="false"> <ItemTemplate> <asp:HiddenField runat="server" ID="lbIDTool" Value='<%# Bind("toolsID") %>' ClientIDMode="Static"/> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn Visible="false"> <ItemTemplate> <asp:Label runat="server" ID="lbIDRisk" Text='<%# Bind("riskID") %>' ForeColor="#92c4f7" Font-Bold="false" Font-Size="9px" Visible="false"></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="num" ItemStyle-CssClass="cellNumTool"> <ItemTemplate> <asp:Label runat="server" ID="lbIDnum" Text='<%# Bind("num") %>' CssClass="numGridAction" Font-Bold="false" Font-Size="13px" Visible="true"></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="NameIncident" ItemStyle-CssClass="cellNameTool"> <ItemTemplate> <asp:LinkButton runat="server" ID="linkIncidentDetail" Text='<%# Bind("name") %>' Font-Overline="false" CssClass="linkIncident" OnCommand="showToolDetail" Font-Size="14px" CommandName="NameClickIncident" CommandArgument='<%# Bind("toolsID") %>' ></asp:LinkButton> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>