This is a migrated thread and some comments may be shown as answers.

radgrid details tables sort icon when page loads

1 Answer 18 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vamsi
Top achievements
Rank 1
Vamsi asked on 21 Apr 2021, 08:00 PM

I want to show Sort Icon on all the columns by default when the RADGrid/DetailTables columns loads for the first time. Currently, the Sort Icon appears only after user clicks on any column.

1. Is there any property on RADGrid that shows Sort Icon by default on RADGrid/DetailTables columns?

2. on the other hand I want have toold tip on first column of the RADGrid/DetailTables columns?

 

 <telerik:RadGrid RenderMode="Lightweight" ID="rgView" ShowStatusBar="true" runat="server" 
            PageSize="12" AllowMultiRowSelection="False"
            AutoGenerateColumns="False" AllowSorting="True" CssClass="grid-forecast"
            OnDetailTableDataBind="rgView_DetailTableDataBind" OnNeedDataSource="rgView_NeedDataSource" >
             <ClientSettings>
                    <Scrolling ScrollHeight=""></Scrolling>
                </ClientSettings>
            <PagerStyle Mode="NumericPages"></PagerStyle>
           <MasterTableView HeaderStyle-CssClass="goalGridHeader" DataKeyNames="MonthNumber" AllowMultiColumnSorting="True" GroupsDefaultExpanded="false">                      
                 <DetailTables>
                    <telerik:GridTableView DataKeyNames="CenterID" Name="ForecastByCenter" Width="100%" HorizontalAlign="Left">
                        <Columns>         
                    <telerik:GridBoundColumn SortExpression="CenterName" ShowSortIcon="true" AllowSorting="true" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle" UniqueName="CenterName" HeaderText="Center Name" HeaderButtonType="TextButton" 
                        DataField="CenterName">                                      
                        
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="NewEO" HeaderText="New+EO" ShowSortIcon="true" HeaderButtonType="TextButton" ItemStyle-BackColor="" ItemStyle-CssClass="col-type1" HeaderStyle-CssClass="hd-type1"
                        DataField="NewEO">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Absent" HeaderText="Absent" ShowSortIcon="true" HeaderButtonType="TextButton" ItemStyle-BackColor="" ItemStyle-CssClass="col-type1" HeaderStyle-CssClass="hd-type1"
                        DataField="Absent">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="EC" HeaderText="Enrollment" ShowSortIcon="true" HeaderButtonType="TextButton" ItemStyle-BackColor="" ItemStyle-CssClass="col-type1" HeaderStyle-CssClass="hd-type1 hd-top"
                        DataField="EC">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="CYNewEO" HeaderText="CY New+EO" ShowSortIcon="true" HeaderButtonType="TextButton"   ItemStyle-CssClass="col-type2" HeaderStyle-CssClass="hd-type2"
                        DataField="CYNewEO">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="CYAbsent" HeaderText="CY Absent" ShowSortIcon="true" HeaderButtonType="TextButton"  ItemStyle-CssClass="col-type2" HeaderStyle-CssClass="hd-type2 hd-top"
                        DataField="CYAbsent">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="CYEC" HeaderText="CY Enrollment" ShowSortIcon="true" HeaderButtonType="TextButton" ItemStyle-CssClass="col-type2 n3" HeaderStyle-CssClass="hd-type2"
                        DataField="CYEC">
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn SortExpression="LYNewEO" HeaderText="LY New+EO" ShowSortIcon="true" HeaderButtonType="TextButton" ItemStyle-CssClass="col-type3" HeaderStyle-CssClass="hd-type3 n1"
                        DataField="LYNewEO">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="LYAbsent" HeaderText="LY Absent" ShowSortIcon="true" HeaderButtonType="TextButton" ItemStyle-CssClass="col-type3" HeaderStyle-CssClass="hd-type3 hd-top"
                        DataField="LYAbsent">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="LYEC" HeaderText="LY Enrollment" ShowSortIcon="true" HeaderButtonType="TextButton" ItemStyle-CssClass="col-type3" HeaderStyle-CssClass="hd-type3"
                        DataField="LYEC">
                        
                    </telerik:GridBoundColumn>                    
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
           <Columns>               
                <telerik:GridBoundColumn DataField="MonthName" HeaderText="Month" ItemStyle-CssClass="col-hd" HeaderStyle-CssClass="hd-type0"  />
                <telerik:GridBoundColumn DataField="NewEO" HeaderText="New+EO"  ItemStyle-BackColor="" ItemStyle-CssClass="col-type1" HeaderStyle-CssClass="hd-type1"/>
                <telerik:GridBoundColumn DataField="Absent" HeaderText="Forecast Absent"  ItemStyle-CssClass="col-type1" HeaderStyle-CssClass="hd-type1 hd-top"/>
                <telerik:GridBoundColumn DataField="EC" HeaderText="Enrollment"  ItemStyle-CssClass="col-type1" HeaderStyle-CssClass="hd-type1 n3"/>
                <telerik:GridBoundColumn DataField="CYNewEO" HeaderText="New+EO"  ItemStyle-CssClass="col-type2" HeaderStyle-CssClass="hd-type2" />
                <telerik:GridBoundColumn DataField="CYAbsent" HeaderText="Actual Absent" ItemStyle-CssClass="col-type2" HeaderStyle-CssClass="hd-type2 hd-top"  />
                <telerik:GridBoundColumn DataField="CYEnrollment" HeaderText="Enrollment" ItemStyle-CssClass="col-type2 n3" HeaderStyle-CssClass="hd-type2" />
                <telerik:GridBoundColumn DataField="LYNewAndEO" HeaderText="New+EO" ItemStyle-CssClass="col-type3" HeaderStyle-CssClass="hd-type3 n1"/>
                <telerik:GridBoundColumn DataField="LYAbsent" HeaderText="LY% Absent" ItemStyle-CssClass="col-type3" HeaderStyle-CssClass="hd-type3 hd-top" />
                <telerik:GridBoundColumn DataField="LYEnrollment" HeaderText="Enrollment" ItemStyle-CssClass="col-type3" HeaderStyle-CssClass="hd-type3" />
                <telerik:GridBoundColumn DataField="ForecastPerCent" HeaderText="% Forecast Completed" ItemStyle-CssClass="col-type4" HeaderStyle-CssClass="hd-type4" />
            </Columns>
            </MasterTableView>
        </telerik:RadGrid>

 

 

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 26 Apr 2021, 05:18 PM

Hi Vamsi,

Please check out the discussion on the following Forum thread about sorting: custom sort on page load radgrid.

You can also check out the official Documentation at Sort Expressions. There you can find an example for Declarative and Programmatic sorting. You can try the Programmatic approach at the initial load. Inside the PreRender event, If Not Page.IsPostBack, then sort by the expression.

Regards,
Attila Antal
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Tags
Grid
Asked by
Vamsi
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or