TreeGrid has no Refresh or ReBind method,

Hi, 

I want to programmatically refresh the TreeGrid after an external form has been used to insert/update data.
This is easy with the DataGrid component as shown below

QueryGrid = new Query().Expand(new List<string> { "CodeType" });
this.grid.Refresh();
However I am unable to do this with the TreeGrid component.
 All I want is to rebind the grid to the OData remote datasource or just refresh the entire TreeGrid.
The available methods below, do not serve that purpose     
await this.grid.RefreshColumns();
await this.grid.RefreshHeader();

Also, custom search functionality is NOT WORKING.
This does not work
private async Task OnSearch()
        {
 
       
            if (!string.IsNullOrEmpty(searchText))
            {
 
                WhereFilter filter1 = new WhereFilter
                {
                    Field = "Code",
                    Operator = "contains",
                    value = searchText
                };
 
                WhereFilter filter2 = new WhereFilter
                {
                    Field = "Name",
                    Operator = "contains",
                    value = searchText
                };
 
                WhereFilter filter3 = new WhereFilter
                {
                    Field = "Description",
                    Operator = "contains",
                    value = searchText
                };
 
                WhereFilter filter4 = new WhereFilter
                {
                    Field = "Header_Name",
                    Operator = "contains",
                    value = searchText
                };
 
                QueryGrid = new Query() 
                .Where(filter1.Or(filter2).Or(filter3).Or(filter4));
 
                //this.grid.Refresh();
                await this.grid.RefreshColumns(); //not working
                await this.grid.RefreshHeader(); //not working
            }
            else
            {
                QueryGrid = new Query();//.Expand(new List<string> { "Parent" });
                //this.grid.Refresh(); not available
                await this.grid.RefreshColumns();
                await this.grid.RefreshHeader();
            }
 
        }

So how do I accomplish these 2 tasks TODAY?
1) Programmatically refresh or rebind the TreeGrid
2) Execute custom search queries on the DataSource/Adaptor

Please respond asap, thanks!

PS: My TreeGrid razor code is below
<SfTreeGrid @ref="grid" ID="gridLocationType" TValue="LocationTypeMasterView"
            IdMapping="Id" ParentIdMapping="ParentId" HasChildMapping="HasChildren" TreeColumnIndex="1"
            AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowSelection="false" EnableAltRow="false"
            AllowResizing="true" ShowColumnChooser="true" ShowColumnMenu="true"
            AllowMultiSorting="true" AllowReordering="true" Width="100%" Height="400">
<SfDataManager Url="@GRID_API_RESOURCE" CrossDomain="true" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager>
 
    <TreeGridPageSettings EnableQueryString="true" PageCount="10" PageSizes="true" PageSizeMode="PageSizeMode.Root">
    </TreeGridPageSettings>
 
    <TreeGridFilterSettings ShowFilterBarStatus="true" HierarchyMode="@FilterHierarchyMode.Parent" Type="Syncfusion.Blazor.TreeGrid.FilterType.Menu"></TreeGridFilterSettings>
 
    <TreeGridEvents TValue="LocationTypeMasterView" OnActionFailure="@ActionFailure"></TreeGridEvents>
<SfToolbar CssClass="d-flex justify-content-between w-100-full py-2">
            <ToolbarItems>
                <ToolbarItem Type="ItemType.Button" CssClass="">
                    <Template>
                        <div class="d-flex justify-content-between">
 
                            <a class="btn btn-sm btn-rounded btn-outline-light btn-gridmenu-inline text-blue font-weight-bold mr-2"
                               @onclick="OnRefresh">
                                <i class="fe fe-refresh-ccw font-weight-bold" aria-hidden="true"></i> Refresh
                            </a>
 
                            <a class="btn btn-sm btn-rounded btn-outline btn-gridmenu-inline text-blue font-weight-bold mr-2"
                               @onclick="OnAddRow">
                                <i class="fe fe-plus-circle font-weight-bold" aria-hidden="true"></i> New
                            </a>
                        </div>
                    </Template>
                </ToolbarItem>
<ToolbarItem Type="ItemType.Input" CssClass="">
                    <Template>
 
 
                        <div class="d-flex justify-content-between">
 
 
                            <div class="input-group input-group-sm">
 
 
                                <input type="text" size="30" class="form-control"
                                       @bind-value="@searchText" @bind-value:event="oninput" @onkeyup="OnSearchEnter"
                                       placeholder="Enter keywords">
 
                                <div class="input-group-append">
                                    <button @onclick="OnClearSearch"
                                            class="btn btn-sm btn-rounded" type="button">
                                        <i class="fe fe-x font-weight-bold2"></i>
                                    </button>
 
                                </div>
                                <div class="input-group-append">
                                    <button @onclick="OnSearch"
                                            class="btn btn-sm btn-rounded btn-outline font-weight-bold" type="button">
                                        <i class="fe fe-search font-weight-bold"></i> Search
                                    </button>
                                </div>
                            </div>
 
                        </div>
 
                    </Template>
                </ToolbarItem>
 
            </ToolbarItems>
        </SfToolbar>
<TreeGridColumns>
       <TreeGridColumn HeaderText="#" TextAlign="TextAlign.Justify" Width="90">
 
           <Template>
               @{
                   var row = (context as LocationTypeMasterView);
 
                   <div class="d-flex flex-row justify-content-center2">
 
                       <a class="btn btn-sm btn-rounded btn-outline btn-grid-inline text-gray-2 font-weight-bold2 mr-2"
                          @onclick="@(e=>OnEditRow(row))">
                           <i class="fe fe-edit-3 font-weight-bold" aria-hidden="true"></i>
                       </a>
 
                       <a class="btn btn-sm btn-rounded btn-outline btn-grid-inline text-gray-4 font-weight-bold2 mr-0"
                          @onclick="@(e=>OnDeleteRow(row))">
                           <i class="fe fe-trash-2 font-weight-bold" aria-hidden="true"></i>
                       </a>
 
                   </div>
 
               }
           </Template>
</TreeGridColumn>
      <TreeGridColumn Field=@nameof(LocationTypeMasterView.Name) HeaderText="Name"></TreeGridColumn>
      </TreeGridColumns>
</SfTreeGrid>

14 Replies

PS Pon Selva Jeganathan Syncfusion Team July 27, 2020 02:43 PM UTC

Hi  Ozioma 
  
Greetings from Syncfusion Support. 
Query: TreeGrid has no Refresh or ReBind method 
Currently we have not provided support for the "refresh" method. And Support for this method will be included in our upcoming nuget release which is expected to be rolled out on or before 1st week of August.  
Note: we will share the feedback link shortly. 
Until then we appreciate your patience. 
  
Regards, 
Pon selva 
 



OZ Ozioma July 28, 2020 12:41 AM UTC

Hi,
Thanks!

Will be waiting for your update.

Also, will you include support for custom queries? 
Like I showed in my first post?
private async Task OnSearch()
        {
 
       
            if (!string.IsNullOrEmpty(searchText))
            {
 
                WhereFilter filter1 = new WhereFilter
                {
                    Field = "Code",
                    Operator = "contains",
                    value = searchText
                };
 
                WhereFilter filter2 = new WhereFilter
                {
                    Field = "Name",
                    Operator = "contains",
                    value = searchText
                };
 
                WhereFilter filter3 = new WhereFilter
                {
                    Field = "Description",
                    Operator = "contains",
                    value = searchText
                };
 
                WhereFilter filter4 = new WhereFilter
                {
                    Field = "Header_Name",
                    Operator = "contains",
                    value = searchText
                };
 
                QueryGrid = new Query() 
                .Where(filter1.Or(filter2).Or(filter3).Or(filter4));
 
                //this.grid.Refresh();
                await this.grid.RefreshColumns(); //not working
                await this.grid.RefreshHeader(); //not working
            }
            else
            {
                QueryGrid = new Query();//.Expand(new List<string> { "Parent" });
                //this.grid.Refresh(); not available
                await this.grid.RefreshColumns();
                await this.grid.RefreshHeader();
            }
 
        }

I need to be able to programmatically change the underlying query for the OData data source.

Thanks again.
Ozioma


PS Pon Selva Jeganathan Syncfusion Team July 28, 2020 01:14 PM UTC

  
  
Hi Ozioma 

Thanks for the update. 
 
Query#:- support for custom queries? 

When We provide the support for refresh method, this custom query also worked. But before calling the refresh method, you can assign these custom queries to the treegrid query property.  

You can track the current status of your request, review the resolution timeline and contact us for any further inquiries through this link.      
  
Note: To view the above feedback, kindly login into your account.      
  
Please get back to us if you need any further assistance.  
  
Regards, 
Pon selva  



OZ Ozioma July 31, 2020 04:11 AM UTC

Hi,

Any update yet?
I've seen releases 18.2.0.46 and 18.2.0.47 that did not include the fixes I requested for.
Is there still a plan to ship the fixes to TreeGrid?


Also after testing with v0.47, I just discovered the functionalities that were working before have stopped working.
The below methods do not work with the latest releases

await grid.ClearFiltering(); //can't tell if this works or not
await grid.FilterByColumn("Name", "contains", searchText); //this does not work

//
await grid.GoToPage(1); //have to call more than once for this to work, does not work all the time

REMINDER: Custom queries are still not working.

I look forward to the fixes being included the latest release.

Thanks!



GL Gowri Loganathan Syncfusion Team August 3, 2020 12:46 PM UTC

Hi Ozioma, 
 
Thanks for contacting Syncfusion Forum. 
 
Query#1: refresh method in blazor treegrid not works 
 
The fix for the reported issue has not yet been released and will be included in our upcoming weekly nuget release due to be rolled out on or before August 5th, 2020.  
Once we provided support for refresh method these custom queries also worked. 
 
Until then we appreciate your patience. 
 
Query#2: Clearfiltering , filterbycolumn , GoToPage method not working in latest version of TreeGrid 
 
We have analysed your query and we are unable to reproduce the reported issue except for clearFiltering method in our latest version. We have prepared a sample with the mentioned methods in blazor TreeGrid and refer it below, 
 
Code 
<SfButton OnClick="clear">Clear</SfButton> 
<SfButton OnClick="filter">filter</SfButton> 
<SfButton OnClick="page">page</SfButton> 
 
<SfTreeGrid @ref="grid" DataSource="@TreeData" IdMapping="TaskId" ParentIdMapping="ParentId"> 
    ………………………… 
    @code{ 
   ................  
    private void clear() 
    { 
    grid.ClearFiltering(); 
 
    } 
    private void filter() 
    { 
    grid.FilterByColumn("TaskId", "contains", 2); 
    } 
    private void page() 
    { 
    grid.GoToPage(2); 
    } 
    } 
 
Sample link 
 
Output Video 
 
When using clearFiltering method it works only on second time of click, which is the known issue in our component and fix for the same will be included in our upcoming patch release which will expected to be rolled out in the second week of August 2020. 
 
Please revert us if you need further assistance. 
 
Regards, 
Gowri V L 
 



GL Gowri Loganathan Syncfusion Team August 7, 2020 01:13 PM UTC

Hi Ozioma, 
 
Query#1: support for refresh method and custom queries for treegrid 
 
We have provided the refresh method to refresh Tree Grid content manually in V18.2.0.48, but we are facing some issue with custom search queries and the same will be fixed in our nuget release after volume 2 Service Pack 1 release which is expected to be rolled out in the end of August 2020. 
 
Until then we appreciate your patience. 
 
Query#2: ClearFiltering() method issue 
 
We are happy to announce that fix for the issue has been rolled out successfully. To overcome this problem, we suggest you to upgrade your version to "18.2.0.48".  
 
Kindly revert us if you need more assistance. 
 
Regards, 
Gowri V L 
 



OZ Ozioma August 7, 2020 04:36 PM UTC

Hi,

Thanks for the update!
I have tested the v0.48 and the Refresh method works as expected.
Many thanks!

However there are still some bugs I have noticed.
One key functionality that is a deal breaker right now is arbitrary levels in the  tree hierarchy.
I noticed in the Financials Module, that when I expand the chart of accounts at level 3,
I get the error below

Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: The specified key 'checkboxState' does not exist in the ExpandoObject.
System.Collections.Generic.KeyNotFoundException: The specified key 'checkboxState' does not exist in the ExpandoObject.
   at System.Dynamic.ExpandoObject.System.Collections.Generic.IDictionary<System.String,System.Object>.get_Item(String key)
   at Syncfusion.Blazor.TreeGrid.Internal.TreeCell`2.ExpandCollapseClick(MouseEventArgs e)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

When you expand beyond 2 levels, you get the error above.
This happens for all instances of the TreeGrid after the update.
The markup is as before.


Please kindly fix this one asap!

Thanks again

PS: Your rich text editor does not support copy and paste from NotePad, VS Code etc. Why?
It works and then stops working all of a sudden.




OZ Ozioma August 9, 2020 01:11 AM UTC

Hello guys,

It's been 2 days and I'm yet to get an update.
An update to the last issue would be greatly appreciated.

Thanks again!



OZ Ozioma August 9, 2020 06:30 PM UTC

Hi guys,

I want to report another bug/issue with the TreeGrid.
When you run a custom search using WhereFilter conditions like below,
a hidden condition for the ParentId column being null gets appended to the OData query

WhereFilter codeFilter = new WhereFilter
{
Field = "Code",
Operator = "contains",
value = searchText
};

WhereFilter nameFilter = new WhereFilter
{
Field = "Name",
Operator = "contains",
value = searchText
};

WhereFilter descriptionFilter = new WhereFilter
{
Field = "Description",
Operator = "contains",
value = searchText
};

WhereFilter parentCodeFilter = new WhereFilter
{
Field = "Header_Code",
Operator = "contains",
value = searchText
};

WhereFilter parentNameFilter = new WhereFilter
{
Field = "Header_Name",
Operator = "contains",
value = searchText
};

QueryGrid = new Query()
.Where(companyFilter.And((codeFilter).Or(nameFilter).Or(descriptionFilter)));
grid.Refresh();
----------------------------------
This is the final SQL that is being generated
exec sp_executesql N'SELECT [f].[Id], [f].[AccountType], [f].[AllowManualEntry], [f].[AvailableBalance], [f].[ChildCount], [f].[ClearedBalance], [f].[Code], [f].[Comments], [f].[CreateKey], [f].[CreatedBy], [f].[CreatedByUserName], [f].[CurrencyId], [f].[CurrencyId_Code], [f].[CurrencyId_DecimalPlaces], [f].[CurrencyId_Format], [f].[CurrencyId_IsActive], [f].[CurrencyId_IsDeleted], [f].[CurrencyId_Name], [f].[CurrencyId_Symbol], [f].[CurrencyId_Tags], [f].[DateCreated], [f].[DateDeleted], [f].[DateUpdated], [f].[DefaultBalanceType], [f].[DefaultCompanyId], [f].[DeleteKey], [f].[DeletedBy], [f].[DeletedByUserName], [f].[Description], [f].[FullText], [f].[HasChildren], [f].[HeaderType], [f].[Header_AccountType], [f].[Header_AllowManualEntry], [f].[Header_AvailableBalance], [f].[Header_ClearedBalance], [f].[Header_Code], [f].[Header_CurrencyId], [f].[Header_DefaultBalanceType], [f].[Header_HeaderType], [f].[Header_IsActive], [f].[Header_IsDeleted], [f].[Header_Name], [f].[Header_ParentId], [f].[Header_Tags], [f].[Header_UnclearedBalance], [f].[IsActive], [f].[IsDeleted], [f].[IsUpdated], [f].[MarkForDelete], [f].[MarkForUpdate], [f].[MetadataJson], [f].[MetadataXml], [f].[Name], [f].[ParentId], [f].[Remarks], [f].[RowKey], [f].[RowVersion], [f].[UnclearedBalance], [f].[UpdateKey], [f].[UpdatedBy], [f].[UpdatedByUserName]
FROM [Fin].[FinancialAccountMasterView] AS [f]
WHERE ([f].[IsDeleted] <> CAST(1 AS bit)) AND ((([f].[DefaultCompanyId] = @__TypedProperty_0) AND ((((@__TypedProperty_1 = N'''') OR (CHARINDEX(@__TypedProperty_1, [f].[Code]) > 0)) OR ((@__TypedProperty_2 = N'''') OR (CHARINDEX(@__TypedProperty_2, [f].[Name]) > 0))) OR ((@__TypedProperty_3 = N'''') OR (CHARINDEX(@__TypedProperty_3, [f].[Description]) > 0)))) AND [f].[ParentId] IS NULL)
ORDER BY [f].[Id]
OFFSET @__TypedProperty_4 ROWS FETCH NEXT @__TypedProperty_5 ROWS ONLY',N'@__TypedProperty_0 bigint,@__TypedProperty_1 nvarchar(128),@__TypedProperty_2 nvarchar(256),@__TypedProperty_3 nvarchar(4000),@__TypedProperty_4 int,@__TypedProperty_5 int',@__TypedProperty_0=3,@__TypedProperty_1=N'pay',@__TypedProperty_2=N'pay',@__TypedProperty_3=N'pay',@__TypedProperty_4=0,@__TypedProperty_5=12

The solution I think is to remove the generated where condition filter for the ParentId column
like so
AND [f].[ParentId] IS NULL
The above condition gets appended to each query when you run a custom search.
This does not return accurate results as only top level rows with no children match that criteria.

Please can you fix this asap?
Also the expand bug I reported is still not fixed. This happens when you expand a node at level 2.
The exception trace is below
Unhandled exception rendering component: The specified key 'checkboxState' does not exist in the ExpandoObject.
System.Collections.Generic.KeyNotFoundException: The specified key 'checkboxState' does not exist in the ExpandoObject.
   at System.Dynamic.ExpandoObject.System.Collections.Generic.IDictionary<System.String,System.Object>.get_Item(String key)
   at Syncfusion.Blazor.TreeGrid.Internal.TreeCell`2.ExpandCollapseClick(MouseEventArgs e)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)


Thanks again!



GL Gowri Loganathan Syncfusion Team August 10, 2020 12:10 PM UTC

  
Hi Ozioma, 
 
Thanks for contacting Syncfusion Forum. 
 
Query#1: When you run a custom search using WhereFilter conditions , a hidden condition for the ParentId column being null gets appended to the OData query 
 
We have validated the defect you have initiated with us. Thank you for taking the time to report the issue and helping us improve our product. At Syncfusion we are committed to fixing all the validated defect (subject to technological feasibility and Product Development Life Cycle) and including its fix in our subsequent release. As we said already that we are facing some issues with custom search queries , so fix for the same will be included in our Nuget release after the Volume 2 Service Pack 1 release which is expected to be rolled out in the end of August 2020. 
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.    
 
Note: To view the above feedback, kindly login into your account.   
 
Until then we appreciate your patience. 
 

Query#2: Error thrown while expanding the tree level beyond 2nd level.

We have validated the defect you have initiated with us. Thank you for taking the time to report the issue and helping us improve our product. At Syncfusion we are committed to fixing all the validated defect (subject to technological feasibility and Product Development Life Cycle) and including its fix in our subsequent release. So fix for the issue will be included in our Volume 2 SP1 release which is expected to be rolled out in the mid of August, 2020.  
 
Query#3: Your rich text editor does not support copy and paste from NotePad, VS Code etc. Why?It works and then stops working all of a sudden. 
 
We have validated your reported query with Rich Text Editor and unable to replicate the issue reported. We have tried copy and pasting the contents from Notepad/ Vs code which works fine. We have prepared a sample with Rich Text Editor using the latest version 18.2.48.  
 
 
 Can you please share us the following details,  
  • The content you have copied and pasted ?
  • The screenshot of the error log if any?
  • Are you able to reproduce the reported issue in the above shared sample?
 
 The above details will be helpful for us to validate and provide solution at earliest.  
 
Kindly get back to us, if you need more assistance. 
 
Regards, 
Gowri V L 
 



OZ Ozioma August 11, 2020 05:38 AM UTC

Hi,

Thanks for the feedback. Much appreciated.

Would it be ok to suggest the adoption of a nightly or quickfix release builds?
Like situations like these really affect the buy or not buy decisions.
IMO some fixes can be done within hours and rolled out in a quickfix or nightly build so customers can keep on operating
while waiting for a major release.
Also I think (IMHO) this makes your QA/QC cycle more efficient as you get to push out changes for customers to test and return feedback asap.
There are bugs that are more likely to be discovered by the actual end users, rather than the developers.

If it's possible, I think you should strongly consider adopting a quickfix release on a separate/preview release channel.

Regards,
Ozioma


GL Gowri Loganathan Syncfusion Team August 13, 2020 12:26 PM UTC

Hi Ozioma, 
 
Thanks for the update. 
 
Query: Would it be ok to suggest the adoption of a nightly or quickfix release builds? 
 
At Syncfusion, we greatly appreciate the customer feedback. Thank you for taking the time to provide the feedback and helping us improve our product. For customer benefits, we offer the below things.   
 
       1.  Shorter release cycles including weekly releases. 
2.  Custom bug fixes with a timeline commitment that can also be prioritized depending on criticality of the bug  
3.  For evaluators, we offer the same level of support including 24 hours (Monday – Friday) turnaround and bug-fix support and remote web support that is provided to our licensed customers 
 
As we said, we are committed to fixing all the validated defect (subject to technological feasibility and Product Development Life Cycle) and including its fix in our subsequent release (i.e. every week). Since we have already planned our Volume 2 Service Pack release in this week (i.e. 2nd week of August) so, we committed to fix the reported issue(“Custom Query filtering”) and it will be included in our weekly nuget release which is planned after our Volume 2 Service Pack release. 
 
Regards, 
Gowri V L 



OZ Ozioma August 27, 2020 05:38 PM UTC

Hi guys,

Thanks for the great work refining these controls.

I am wondering if it's possible to test some of these releases thoroughly before publishing them?
Like the latest release 18.2.0.55 has messed up the TreeGrid control.
All the nodes are now displayed without a hierarchy in a flat mode.
I am sure if these changes are tested and the display checked for correctness, these bugs would be identified on time.

Also the issue with custom queries on the TreeGrid still persists, though now a different query appears to be issued.
I think the logic behind the first display query needs to be checked for correctness.
Maybe the first display query should include the null condition for the ParentId, then when a custom query is being run,
the ParentId null condition should not be included.
Just my thoughts...

Please revert asap.

Thanks,
Ozioma

Kindly revert


MP Manivannan Padmanaban Syncfusion Team August 28, 2020 01:37 PM UTC

Hi Ozima, 

Query 1: All the nodes are now displayed without a hierarchy in a flat mode. 

The above issue arises when you return the dataSource directly without filtering the root node (i.e. the parentID null records). We recommend that you return the filtered dataSource as in the sample below. 

Query 2: Maybe the first display query should include the null condition for the ParentId, then when a custom query is being run, 
the ParentId null condition should not be included 

At our end, we are unable to reproduce the reported problem. For your convenience, we have built a custom query sample in the version mentioned (18.2.55). We got the parentID null in the filter query at the initial rendering. Please refer to the screenshot below, 

 

And when we pass custom query, this replaces the parentID null query. Refer to Screenshot below, 

 


Note: Also, we suggest you to use “equal” operator for integer value in custom filter query. 

Please come back to us for further assistance. 

Regards, 
Manivannan Padmanaban 


Loader.
Up arrow icon