Author Topic: filter options from database  (Read 1821 times)

orlando_acevedo

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 27
    • View Profile
filter options from database
« on: December 05, 2018, 12:13:54 pm »
Hi pqTeam,

I have an infinite scrolling grid that I am upgrading to version 5.6. Since the data is loaded incrementally, I need to feed the filter options directly from the database.
The code I found on the forum and documentation is not working though, and when runs, it makes the filter be blank.
Here is what I have:
Code: [Select]

$.getJSON('@Url.Action("AuditFilterOptions", "Audits")', function (data) {

            filterMG = $("#grid_audits").pqGrid("getColumn", { dataIndx: 'ManagementGroup' }).filter;
            filterMG.cache = null;
            filterMG.options = data.ManagementGroups;

            $("#grid_audits").pqGrid("refreshHeader");
        });




Thank you,

OA

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: filter options from database
« Reply #1 on: December 05, 2018, 12:57:25 pm »
data.ManagementGroups should be array of objects in this format.

Code: [Select]
[
  {ManagementGroup: val1},
  {ManagementGroup: val2},
  {ManagementGroup: val3},
  ...
]

orlando_acevedo

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: filter options from database
« Reply #2 on: December 06, 2018, 10:49:06 pm »
That worked.


Thank you!!!


OA.