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

Reference SfQueryBuilder to be null

Hi Support,


My scenario as follows : 

After the other process update the data, I want to Click the  button to  refresh QueryBuilder data from database again by the Created() event . But  it return null  for the reference SfQueryBuilder object .

Attach is my project (Page-->View-->ViewModel).


Please kindly help!

Jacky





Attachment: Blazor_27_3_e5251e3b.zip

7 Replies 1 reply marked as answer

YA YuvanShankar Arunagiri Syncfusion Team April 11, 2023 10:02 AM UTC

Hi Jacky,


Sorry for the delay. We have validated your attached sample, and the reason for the reported issue is that the query builder is created only when we open the dialog popup and destroyed when the dialog popup is closed. After you closed the dialog popup, you were using the query builder reference, and it threw an error. And could you please share what are trying to do in refresh QueryBuilder button click. Because you have already taken the data manager query and refreshed the view in the OkClick function, and again, you took the same action in the refresh QueryBuilder button click.


public void OkClick()

    {

        GridQuery = querybuilder.GetDataManagerQuery();

        thisView.NeedRefreshAsync();

        this.IsShowQueryBuilder = false;

    }


If you share the exact use case/details for refresh QueryBuilder button click, we will check and provide the better solution.


Regards,

YuvanShankar A



JA Jacky April 13, 2023 10:57 PM UTC

Hi YuvanShankar,


I simulated my project requirements, first step  [Update Order Data] button will open a dialog , it will update the Order data Sequenct to the database table by SfListBox Drag & Drop, and then close the Dialog will  [Refresh QueryBuilder] to requery and synchronize the data in Querybuilder and Grid.


Best Regards!

Jacky


Open a Dialog for Drap & Drop adjust the Order sequence with SfListBox and update to database.




YA YuvanShankar Arunagiri Syncfusion Team April 14, 2023 04:39 PM UTC

Jacky,


As we started earlier, when dialog popup closes the query builder element will destroy, so we can’t take query builder instance after closed the dialog popup. So, kindly assign the GetDataManagarQuery in another variable, and used that variable while click on refresh QueryBuilder button.


public void OkClick()

    {

        GridQuery = DummyQuery = querybuilder.GetDataManagerQuery();

        thisView.NeedRefreshAsync();

        this.IsShowQueryBuilder = false;

    }

…….

public void RefreshQueryBuilder()

    {

        GridQuery = DummyQuery;

        thisView.NeedRefreshAsync();

    }


Get back to us if you need any further assistance on this. 



JA Jacky replied to YuvanShankar Arunagiri April 17, 2023 04:05 AM UTC

Hi YuvanShankar,


I'm sorry, maybe I didn't express myself clearly enough.

If I use the DummyQuery in  RefreshQueryBuilder(), the data is not the Actual data in the database.

It must reopen the QueryBuilder dialog and trigger the  OkClick() event.


Best Regards!

Jacky






YA YuvanShankar Arunagiri Syncfusion Team April 20, 2023 02:49 PM UTC

Sorry for the delay, Jacky.


From your last update, we suspect that you changed the database of the grid component and need to refresh the grid with the latest dataSource using the existing filter. And as we already said, the filterQuery variable does not depend on the dataSource except that you didn’t change any fields. So, refresh with the existing filterQuery variable filters the proper result with the latest datasource. If you change the fields of the dataSource, then you must open the query builder and create a new query with new fields to filter the dataSource.


Marked as answer

JA Jacky April 21, 2023 07:14 AM UTC

Hi  YuvanShankar,


i understand, Thank for your kindly help!


Best Regards!

Jacky



YA YuvanShankar Arunagiri Syncfusion Team April 24, 2023 04:36 AM UTC

You're welcome, Jacky. We are glad to hear that your issue has been resolved now. Please get back to us if you need any other assistance.


Note: If that post is helpful, please consider accepting it as the solution so that other members can locate it more quickly.


Loader.
Up arrow icon