Some questions about DataGrid
I've few questions about SdDataGrid.
How to align cell value to center ?
How format cell value without using a different property ? Like cell value appear "123" and I want it to show "123 Kg". Like binding with StringFormat.
How to make a column to fill the rest of space? Like there are 3 columns, and I want second column to fill the space.
How to hide a column without setting its width to 0 ?
How to align cell value to center ?
How format cell value without using a different property ? Like cell value appear "123" and I want it to show "123 Kg". Like binding with StringFormat.
How to make a column to fill the rest of space? Like there are 3 columns, and I want second column to fill the space.
How to hide a column without setting its width to 0 ?
SIGN IN To post a reply.
1 Reply
SP
Shobika Palani
Syncfusion Team
March 18, 2019 01:17 PM UTC
Hi Xmen,
Thanks for contacting Syncfusion Support.
We have analyzed your query and you can find answers for your queries from the below table
|
Query |
Answer | ||
|
How to align cell value to center ?
|
We have analyzed your query to change the alignment of cells in SfDatGrid and you can achieve this by using the following ways.
Case 1 : If you want to use same alignment to all the cells in a grid, refer to following code snippet
Note :
By using the above solution, horizontal alignment will not be changed for the below columns
Case 2 : If you want to use different alignment for different columns, you can make use of GridColumn.TextAlignment property. Please refer to following code snippet
| ||
|
How format cell value without using a different property ? Like cell value appear "123" and I want it to show "123 Kg". Like binding with StringFormat.
|
You can achieve this by writing DisplayBinding for the specific column. Please refer to the below KB article to know more details on formatting cell value
KB Link:
Also please refer to the below UG Link
UG Link:
| ||
|
How to make a column to fill the rest of space? Like there are 3 columns, and I want second column to fill the space.
|
You can set column sizer of specific column as AutoLastColumnFill or AutoWithLastColumnFill.
Please refer to the below UG link for more details
UG Link:
| ||
|
How to hide a column without setting its width to 0 ?
|
By default, we will set column width as 0 when you hide the column. Can you please let us know why you do not want to make the column width as 0 while hiding? |
Please let us know, if you need any further assistance on this.
Regards,
Shobika.
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
JO John
- Mar 18, 2019 02:56 AM UTC
- Mar 18, 2019 01:17 PM UTC