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. Image for the cookie policy date
close icon

Reloading/Re-binding sfDatagrid is messing up the layout

I am not sure if it is know problem. But I dont encounter same problem on standard listview of xamarin.forms. If view is loaded and sfdatagrid is binded with the Items object. if i reloaded/rebind the list again without clearing it, Things get messy. items get into each other. if I have grouping, Grouping will also disapear. If this is known issue, I dont know how to clear the list without binding with null object. Do you know anything about it?
AutoGenerateColumns="False"
AllowSorting="True"
IsEnabled="True"
ColumnSizer="Star"
AllowSwiping="True"
MaxSwipeOffset="180"
GridTapped="dataGrid_GridTapped"
SelectionMode="{Binding GridSelectionMode}"
SelectionChanged="SuperSetSelectionChanged"
AutoExpandGroups="True"
AllowGroupExpandCollapse="True"
RowHeight="100" ItemsSource="{Binding Items}"
SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}" VerticalOptions="FillAndExpand">
....

4 Replies

EM Emil December 23, 2016 01:46 PM UTC

  <sfgrid:SfDataGrid  ScrollingMode="PixelLine"  x:Name="listItems"
                        AutoGenerateColumns="False"
                        AllowSorting="True"
                           IsEnabled="True"
                        ColumnSizer="Star"
                        AllowSwiping="True"
                        MaxSwipeOffset="180"
                        GridTapped="dataGrid_GridTapped"
                        SelectionMode="{Binding GridSelectionMode}"
                              SelectionChanged="SuperSetSelectionChanged"
                         AutoExpandGroups="True"
                          AllowGroupExpandCollapse="True"
                        RowHeight="100" ItemsSource="{Binding Items}"
             SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"  VerticalOptions="FillAndExpand">


AN Ashok N Syncfusion Team December 27, 2016 11:02 AM UTC

Hi Emil, 

Thanks for contacting Syncfusion support. 

We are able to reproduce the reported problem. Currently we do not have support for maintaining the old values while we change the Items. We will provide the support for maintaining the old values while we change the Items in our upcoming 2016 Vol 4 SP release, which will be rolling out within this week. We will update you once the release rolls out.  

Note: If we want to maintain the Grouping while we change the new items, we need to add that grouped column by manually. And we need to set the SfDataGrid.AutoGenerateColumnsMode as other than ResetAll. 

Regards, 
Ashok 



EM Emil December 27, 2016 03:38 PM UTC

Is that the reason why there is special filtering on sfdatagrid (https://help.syncfusion.com/xamarin/sfdatagrid/filtering) ? because I am getting memory problem if I implement filtering using mvvm by simply filtering my binded ObservableCollection and Raising PropertyChanged event. I believe this is causing memory problem when it is raised several times. is there a simple way to handle this?


        public override void Find()
        {
            List<Item> foundItems;
            if (string.IsNullOrWhiteSpace(SearchText) == false)
                foundItems = AllItemTemplates.Where(p => p.name.ToLower().Contains(SearchText.ToLower())).ToList();
            else
                foundItems = AllItemTemplates;

            if (foundItems != null)
            {
                ItemTemplates = new ObservableCollection<Item>(foundItems);
                RaisePropertyChanged("ItemTemplates");
            }
        }


AN Ashok N Syncfusion Team December 28, 2016 07:00 PM UTC

Hi Emil, 
 
In our SfDataGrid we do not have support for columns level filtering and already we have logged this feature in our feature management system. So we have provides support to filter the records in view by setting the SfDataGrid.View.Filter property. Memory problem will not occurred while using this SfDataGrid.View.Filter. If you are facing the memory problem in you sample while using SfDataGrid.View.Filter? could you please share that sample along with replication procedure, that would be more helpful for further analyze. 
 
Regards, 
Ashok  


Loader.
Live Chat Icon For mobile
Up arrow icon