Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Filters not Working #31

Open
rileybwesley opened this issue Nov 3, 2022 · 2 comments
Open

Global Filters not Working #31

rileybwesley opened this issue Nov 3, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@rileybwesley
Copy link

rileybwesley commented Nov 3, 2022

I noticed the global filters are not working. Made a quick work around to handle:

        protected virtual void ProvisionGlobalSearchPayload(ref TableFilterModel tableFilterPayload, string[] props)
        {
            if (!tableFilterPayload.Filters.ContainsKey("global"))
                return;
            foreach (var prop in props)
            {
                var value = (tableFilterPayload.Filters["global"] as JObject)["value"];
                var matchMode = (tableFilterPayload.Filters["global"] as JObject)["matchMode"];
                if (tableFilterPayload.Filters.ContainsKey(prop))
                {
                    tableFilterPayload.Filters[prop] = new JArray { new JObject
                    {
                        ["value"] = value,
                        ["matchMode"] = matchMode,
                        ["operator"] = "or"
                    }};
                }
                else
                {
                    tableFilterPayload.Filters.Add(prop, new JObject
                    {
                        ["value"] = value,
                        ["matchMode"] = matchMode,
                        ["operator"] = "or"
                    });
                }
            }
            tableFilterPayload.Filters.Remove("global");
        }

Forces you to define global filters on serverside but seems to work nice :)

Might be able to use this to work it into the library...

@Kusumoto Kusumoto added the enhancement New feature or request label Nov 3, 2022
@Kusumoto
Copy link
Owner

Kusumoto commented Nov 3, 2022

Hi rileybwesley

Thank you for your solution. Your solution make me inspire for implement global filter for this library.

@rileybwesley
Copy link
Author

No problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants