Display Row Number

10 posts, 0 answers
  1. Scott Rakestraw
    Scott Rakestraw avatar
    84 posts
    Member since:
    Sep 2005

    Posted 19 Nov 2009 Link to this post

    Is there an easy way to add the row number to the indicator presenter?
  2. Thomas LEBRUN
    Thomas LEBRUN avatar
    66 posts
    Member since:
    Sep 2009

    Posted 20 Nov 2009 Link to this post

    Yes, I agree; it would be very useful (that and the possibility to have the total number of rows)....
  3. DevCraft banner
  4. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 20 Nov 2009 Link to this post

    Hi Scrott,

    The indicator cells are not very customizable at the moment and I would suggest to hide the indicator column and create another regular column to simulate the behavior of the indicator one. Once you do that it is very easy to display the row numbers. 

    I have prepared a solution that demonstrates how this can be done in two different ways. 

    Also it is very easy to determine the total number of rows by inspecting the RadGridView.Items.Count property.

    Hope this helps.


    Best wishes,
    Milan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Thomas LEBRUN
    Thomas LEBRUN avatar
    66 posts
    Member since:
    Sep 2009

    Posted 21 Nov 2009 Link to this post

    Hi Milan,

    The solution you provided is correct but not valid for me: my customer ask me to insert the row number in the cell where is the indicator presenter. After looking at the template and using a converter, i've managed to do it (ie: i've the row number when the line is not selected and the indicator presenter when the line is selected), but i've an issue: if there are a lot of line (more than 1000), the column of the indicator presenter/row number is not expanding so the row number is truncated.

    You can see a capture/image of the issue here: http://img689.imageshack.us/img689/1356/capturepw.jpg

    Any ieas ?


    Thanks !
  6. Thomas LEBRUN
    Thomas LEBRUN avatar
    66 posts
    Member since:
    Sep 2009

    Posted 24 Nov 2009 Link to this post

    Hi,

    Any ideas on that ?


    Thanks !
  7. Thomas LEBRUN
    Thomas LEBRUN avatar
    66 posts
    Member since:
    Sep 2009

    Posted 25 Nov 2009 Link to this post

    Nobody got an idea ? This is a quite urgent problem for us because we'll be in production in a few days :)
  8. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 25 Nov 2009 Link to this post

    Hello Thomas LEBRUN,

    The easiest way to resize the indicator columns is by using the row loaded event:

    public MainPage()
    {
        InitializeComponent();
      
        this.playersGrid.ItemsSource = Club.GetPlayers();
        this.playersGrid.RowLoaded += new System.EventHandler<Telerik.Windows.Controls.GridView.RowLoadedEventArgs>(playersGrid_RowLoaded);
    }
      
    void playersGrid_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
    {
        var indicatorPresenter = e.Row.ChildrenOfType<Border>().Where(el => el.Name == "PART_IndicatorPresenter").FirstOrDefault();
      
        if (indicatorPresenter != null)
            indicatorPresenter.Width = 200;
    }

    Hope this helps.

    Best wishes,
    Milan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Thomas LEBRUN
    Thomas LEBRUN avatar
    66 posts
    Member since:
    Sep 2009

    Posted 26 Nov 2009 Link to this post

    Hi Milan,

    I've tried your code. It works fine exception that:
    - the aggregate funtion (in custom footer) no longer display the result.(as you can see in image attached)
    - The alignment is not well formated/not corrected (as you can see in image attached)


    Any ideas ?


    Thanks !
  10. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 01 Dec 2009 Link to this post

    Hi Thomas LEBRUN,

    It seems that the misalignment occurs because the indicator presenter of the footer is does not have enough space. Could you please try to increase the size of all indicator presenters so that numbers like "5827" have enough space to be displayed. 

    I have also tried to reproduce the other problem but without any luck. Could you please share which version of RadGridView are using at the moment? 


    All the best,
    Milan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Thomas LEBRUN
    Thomas LEBRUN avatar
    66 posts
    Member since:
    Sep 2009

    Posted 02 Dec 2009 Link to this post

    Hi Milan

    Increasing the size of all indicator presenters do the trick, i should have tought to it....


    Thanks !
Back to Top
DevCraft banner