We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Group by SfDataGrid with row autonumber in first column

Thread ID:

Created:

Updated:

Platform:

Replies:

117937 Jan 11,2015 08:35 PM UTC Jan 16,2015 02:14 AM UTC WPF 5
loading
Tags: SfDataGrid
Diego Fernando Urabayen
Asked On January 11, 2015 08:35 PM UTC

I have a SfDataGrid, blinded with dataTable. After grouping i need to have a first column with auto-number. The first record in grouping is a 1 row, and next i+1 to end i+n.

Is it possible to bind the autonumber row in a first column without loop the dataTable?

Saravanan M [Syncfusion]
Replied On January 12, 2015 06:25 PM UTC

 Hi Fernando,

Thanks for contacting Syncfusion support,

We have analyzed your query. We can achieve your requirement by Enabling RowHeader when Group the columns also you need to add the style to display the row number on it.  Please refer the below code snippet to achieve your requirement.

Code snippet[C#]:

this.grid.GroupColumnDescriptions.CollectionChanged += GroupColumnDescriptions_CollectionChanged;

if ((sender as GroupColumnDescriptions).Count > 0)

      this.grid.ShowRowHeader = true;

else

      this.grid.ShowRowHeader = false;

We have prepared a sample based on your requirement and you can download it from below location

Sample: SfDataGrid_RowHeader.zip

You can also refer the below documentation link,

Documentation Link: http://help.syncfusion.com/ug/wpf/documents/rowheader.htm

Please let us know if you have any other queries,

Regards,

Saravanan.M



Diego Fernando Urabayen
Replied On January 12, 2015 09:02 PM UTC

Hi. Thanks for your time.

The solution is close to my problem, but I have to restart to 1 in each group. The idea is to have sequential number in each group. I attach a sample.

Regards,

Diego

Attachment: SyncFusion.png_3881b2cc.zip

Saravanan M [Syncfusion]
Replied On January 13, 2015 12:23 PM UTC


Hi Fernando,

Thanks for your update,

We have analyzed your requirement and you could not show the number in GridIndentCell directly .But you can achieve it by workaround. We have prepared a sample based on your requirement and you can download it from below location.

Sample Location: SfDataGrid_Number.zip

Please let us know if you have any other queries,

Regards,

Saravanan.M



Diego Fernando Urabayen
Replied On January 13, 2015 10:58 PM UTC

Hi, the workaround is very good. Is it possible to bind to the column (GridUnBoundColumn maybe) in order to view the numbers in the PrintPreview function? I need to print the sfDataGrid.

Diego Fernando Urabayen
Replied On January 16, 2015 02:14 AM UTC

I'm trying to bind the row number into column in data grid but not working properly.

<syncfusion:GridUnBoundColumn HeaderText="Pos" Expression="{Binding Converter={StaticResource GroupNumber}, ConverterParameter={RelativeSource Self}}">


Can you help me?

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;