- Home
- Forum
- Xamarin.Forms
- ItemsSource with variable columns and rows
ItemsSource with variable columns and rows
Hello
Urgently looking for a ItemsSource structure which can have variable columns and rows.
System.Data.DataTable could have been one but apparently it is not supported in SyncFusion Xamarin.Forms.
Kindly advise best way to achieve it.
Thanks
SIGN IN To post a reply.
19 Replies
SK
Shivagurunathan Kamalakannan
Syncfusion Team
September 10, 2019 09:58 AM UTC
Hi Abhishek,
Thanks for contacting Syncfusion support.
Your requirement to render DataTable in SfDataGrid Xamarin.Forms cannot be achieved in sample level.
Support to render DataTable in SfDataGrid(Xamarin.Forms) has not been provided. We have added “DataTable binding support in SfDataGrid” to our feature request list, we have already considered to provide support for this and logged feature request for the same. We will implement this feature and it will be included in our upcoming 2019 Volume 3 beta release which will be available in the mid of September 2019.
You can also communicate with us regarding the open features any time using our Feature Report page.
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal.
Regards,
Shivagurunathan
AS
Abhishek Singhal
September 10, 2019 05:37 PM UTC
Hi
Do you have a specific date for that release ?
Looking to urgency, is there another data structure we can use ?
For example: List<List<KeyValuePair>> ?
Thanks
SK
Shivagurunathan Kamalakannan
Syncfusion Team
September 11, 2019 02:44 PM UTC
Hi Abhishek,
Thank you for the update,
Syncfusion upcoming 2019 Volume 3 beta release will be available on 16th September 2019. The support for “DataTable binding support in SfDataGrid” will be available in the mentioned release. We appreciate your patience until then.
Also, you can use List<List<KeyValuePair>> in your application. Please refer the following Kb link for more details.
Regards,
Shivagurunathan
AS
Abhishek Singhal
September 18, 2019 09:30 AM UTC
Please confirm release of 2019 Volume 3 beta. And how to get it.
Also, in the List<Dictionary> example, we have to manually add columns. Doesn't the AutoGenerateColumns work in this case ?
BS
Balasubramani Sundaram
Syncfusion Team
September 19, 2019 01:27 PM UTC
Hi Abhishek,
Thank you for the update,
Query 1: 2019 Volume 3 Beta Release
Our 2019 Volume 3 beta release will be roll out on 20th September 2019. We appreciate your patience until then.
Query 2: AutoGenerateColumn Support with index property
We didn’t have support for AutoGenerateColumn with bound of List<Dictionary> collection, we must to create the column by manually.
We hope this helps. Please let us know, if you need any further assistance.
Regards,
Balasubramani Sundaram
Balasubramani Sundaram
AS
Abhishek Singhal
September 20, 2019 01:56 PM UTC
I can see the release announcement with support for datatable binding.
Pl provide an example for the datatable binding with autogeneratecolumns=true.
Thanks
BS
Balasubramani Sundaram
Syncfusion Team
September 23, 2019 07:22 PM UTC
Hi Abhishek,
Thanks for the update.
We have prepared a sample for “DataTable” with AutoGenerateColumn as true and you can get the sample from below link.
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DynamicDataGrid1467796732
We hope this helps. Please let us know, if you need any further assistance.
Regards,
Balasubramani Sundaram
AS
Abhishek Singhal
October 2, 2019 08:43 PM UTC
Hello
The sample is working fine and the data can be seen.
However, it seems that there is a delay between the time ItemsSource is assigned and the columns are generated.
Is it possible to force the grid to generate columns immediately after ItemsSource is assigned ?
Thanks
BS
Balasubramani Sundaram
Syncfusion Team
October 3, 2019 01:02 PM UTC
Hi Abhishek,
Thanks for the update.
We are unable to see time delay in generating column in our previously provided sample with DataTable. Could you please provide a video of exact scenario of your issue it will help us to provide the solution earlier?
Please refer the below video.
Video Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGrid_Video1980453762
Regards,
Balasubramani Sundaram
AS
Abhishek Singhal
October 5, 2019 08:23 PM UTC
Ok - so here is the exact case.
We are assigning the itemssource in code with autogeneratecolumns=true.
Immediately after assignment, we are checking the columns in the grid and find count=0.
Kindly advise
Thanks
BS
Balasubramani Sundaram
Syncfusion Team
October 7, 2019 07:52 PM UTC
Hi Abhishek,
Thanks for the update.
You can get the column data inside the GridLoaded event in SfDataGrid.
Please refer the below code snippet and sample,
Code snippet [C#]
|
[MainPage.Xaml.cs]
private void Grid_GridLoaded(object sender, GridLoadedEventArgs e)
{
//You can get the generated column inside this event
//var columnsCount = this.Grid.Columns.Count();
} |
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DynamicDataGrid-1985814624
We hope this helps. Please let us know, if you need any further assistance.
Regards,
Balasubramani Sundaram.
AS
Abhishek Singhal
October 7, 2019 08:02 PM UTC
When exactly is the GridLoaded event fired ?
Is there a predictable amount of delay between setting of ItemsSource and GridLoaded event ?
BS
Balasubramani Sundaram
Syncfusion Team
October 8, 2019 10:51 AM UTC
Hi Abhishek
Thanks for the update.
GridLoaded event will fire at the time of DataGrid gets appearing on the screen. In our architecture, we have performed column creation and all other data-oriented operation at the time of layout of the view. Hence, you couldn't able to access the column after initializing the ItemsSource property.
So, we request you to get the column collections on GridLoaded event.
Please get back to us if you require further other assistance from us.
Regards,
Balasubramani Sundaram
Balasubramani Sundaram
AS
Abhishek Singhal
December 25, 2019 07:57 PM UTC
Binding to datatable and setting HeaderText for columns for changing column captions.
Columns are still displaying datatable columnName as captions instead of headertext property.
Tried to call dataGrid.View.Refresh after setting, but still same behaviour.
Kindly advise
KK
Karthikraja Kalaimani
Syncfusion Team
December 30, 2019 12:52 PM UTC
Hi Abhishek,
Thank you for your update.
We have checked the reported issue “Columns are still displaying datatable columnName as captions instead of headertext property” and we are unable to reproduce the issue in our end and it is working fine as expected.
We have attached the tested sample for your reference.
Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/DynamicDataGrid_sample-400304009.zip
Thank you for your update.
We have checked the reported issue “Columns are still displaying datatable columnName as captions instead of headertext property” and we are unable to reproduce the issue in our end and it is working fine as expected.
We have attached the tested sample for your reference.
Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/DynamicDataGrid_sample-400304009.zip
ScreenShot :
|
|
SfDataGrid Version : 17.3.0.9-beta
Xamarin Forms version : 3.6.0.344457
Please let us know the following details,
* SfDataGrid Version
* Xamarin Forms Version
* Which platform you are facing the issue
* SfDataGrid Settings
Regards,
Xamarin Forms 4.4
SfDataGrid 17.3.0.34
In your sample, pl use AutoGenerateColumns="true" instead of false.
And then change the headertext of the columns in code in the GridLoaded event.
Example:
Grid.Columns["OrderID"].HeaderText = "ID"
Grid.Columns["CustomerID"].HeaderText = "Customer ID"
DB
Deepika Balasubramaniyan
Syncfusion Team
January 2, 2020 01:49 PM UTC
Hi Abhishek,
Thanks for the update.
We are able to reproduce the issue “When HeaderText property value is set from GridLoaded event value is not updated” in above Xamarin forms version 4.1. Here we noticed Runtime changes for bindable property does not work in Forms version 4.2 and above, hence issue is due to Xamarin forms FrameWork break. Already we have logged the bug report to Xamarin team. For further reference we have added the frame work bug link here.
Frame work bug link:
https://github.com/xamarin/Xamarin.Forms/issues/8860
So, untill Xamarin frame work fix this issue, we request you to use either set the HeaderText value when creating columns itself instead of setting value from GridLoaded event or use Xamarin Forms 4.1 stable version to overcome the issue.
We hope this helps. Please let us know if you would require any further assistance.
Regards,
Deepika.
AS
Abhishek Singhal
January 2, 2020 03:02 PM UTC
- What is the expected time of resolution of this issue in Xamarin Forms. It is difficult to downgrade Xamarin Forms like this.
- Since we are using AutoGenerateColumns = true, how do we "set the HeaderText value when creating columns itself" ?
When binding to datatable, which property is the grid binding for headertext ?
DB
Deepika Balasubramaniyan
Syncfusion Team
January 3, 2020 07:25 AM UTC
Hi Abhishek Singhal,
Regarding set the HeaderText value for AutoGenerateColumn true case: For AutoGenerateColumn true, you can change the HeaderText value in SfDataGrid.AutoGeneratingColumn event instead of GridLoaded event. Please refer the below code example and tested Sample.
|
[C#]
---
Grid.AutoGeneratingColumn += Grid_AutoGeneratingColumn;
private void Grid_AutoGeneratingColumn(object sender, AutoGeneratingColumnEventArgs e)
{
if (e.Column.MappingName == "OrderID")
{
e.Column.HeaderText = "ID";
}
else if (e.Column.MappingName == "CustomerID")
{
e.Column.HeaderText = "Customer ID";
}
else if(e.Column.MappingName == "CustomerName")
{
e.Column.HeaderText = "Name";
}
else if (e.Column.MappingName == "ShipCountry")
{
e.Column.HeaderText = "Country";
}
else if (e.Column.MappingName == "ShipCity")
{
e.Column.HeaderText = "City";
}
}
--- |
Sample link:https://www.syncfusion.com/downloads/support/forum/147402/ze/DynamicDataGrid_Updated-1150712154.zip
Regarding Xamarin team issue fix expected time line: Since Xamarin team moved the reported issue “Runtime changes for property does not work in Forms version 4.2 and above” to Ready for Work stage we expect they will fix the issue soon. Also, we have asked the approximate time line to include the fix in upcoming Xamarin forms releases. We appreciate your patience until then.
Regards,
Deepika.
SIGN IN To post a reply.
- 19 Replies
- 5 Participants
-
AS Abhishek Singhal
- Sep 9, 2019 03:45 PM UTC
- Jan 3, 2020 07:25 AM UTC