Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - brwncald

Pages: [1] 2
1
Help for ParamQuery Pro / Re: Questions on Inline Editing
« on: April 28, 2022, 06:12:21 am »
Thanks - this helped a lot.
I was able to fix all of the issues.

Cheers,
Geoff

2
Help for ParamQuery Pro / Questions on Inline Editing
« on: April 27, 2022, 03:20:50 am »
Hi,
I have four more questions on inline editing.
See the following JSFiddle for code to demonstrate the issues:
https://jsfiddle.net/glt101/8tsy2b1x/



1) After making a selection in the inline drop down list, the list disappears.
The drop down list needs to keep its current selection and remain visible until the Update or Cancel button is clicked.
How do we prevent the removal of the drop down list after a selection is made?

2) The value chosen in the inline drop down list is used to set which fields are editable.
For example, this is done using:

        var oColumnModel = grid.option("colModel");
        iOrdinal = grid.getColIndx({ dataIndx: "profits" });
        oColumnModel[iOrdinal].editable = true;

However this marks all rows in the column as editable.
How do we set just the field in the currently edited row as editable?

3) After clicking on the drop down list, when scrolling the window to the right, the drop down list does not stay with the column. It remains fixed in its location in the browser window.
How do we maintain the correct position of the drop down list when scrolling the window left and right?
Curiously, in JSFiddle, the selection list disappears as it loses focus (as soon as you click the scroll bar). Neither behavior should happen.

4) When the Cancel button is clicked the changes to the row should be rolled back, but they are not.
How do we make the Cancel button roll back the changes in this case?

Cheers,
Geoff

3
Help for ParamQuery Pro / Re: Current page missing from pager tool
« on: April 21, 2022, 06:13:52 am »
Hi,
I figured this out.
This happens if you do not include the localize file e.g.:
/paramquery-8.2/localize/pq-localize-en.js

Cheers,
Geoff

4
Help for ParamQuery Pro / Current page missing from pager tool
« on: April 21, 2022, 04:56:02 am »
Hi,

I am not seeing the contents of the pager tool that should show "| Page [n] of n |"
where [n] is a text box that contains the currently displayed page (image attachments wouldn't work for me).

See the JSFiddle:
https://jsfiddle.net/glt101/zgyqLbak/

Cheers,
Geoff

5
Thanks. I will try this.
Cheers,
Geoff

6
Hi,

Here is a complete example.
Since both the data and the filter options are loaded from a remote source I can't easily create a JSFiddle. The code is at the bottom of this post.

The first two columns work fine. This is because the values and labels within the options returned by the call to buildFilterDropDown(ui, "/Home/GetBusinessUnits"); are the same:

[
  {"BusinessUnit":"","BusinessUnitName":" Select a business unit"},
  {"BusinessUnit":"Business Unit 1","BusinessUnitName":"Business Unit 1"},
  {"BusinessUnit":"Business Unit 2","BusinessUnitName":"Business Unit 2"},
  {"BusinessUnit":"Business Unit 3","BusinessUnitName":"Business Unit 3"}
]
Upon clicking the checkbox in the filter grid, the client sends the following to the server to get the filtered data:
https://localhost:99999/Home/spGetUserList?pq_datatype=JSON&pq_filter={"mode":"AND","data":[{"dataIndx":"LocationName","dataType":"string","value":["Box Elder, SD"],"condition":"range"},{"dataIndx":"BusinessUnit","dataType":"string","value":["Business Unit 1"],"condition":"range"}]}&_=1650319707694

The data is correctly filtered down to those records having BusinessUnit = "Business Unit 1"

The problem is with column 3.
The values and labels within the options returned by the call to buildFilterDropDown(ui, "/Home/GetLocations"); are different (as they would be for any traditional name value pair like state name/state code; airport name/airport code etc.):

[
 {"LocationCode":"","LocationName":" Select a location"},
 {"LocationCode":"10","LocationName":"Alexandria, VA"},
 {"LocationCode":"11","LocationName":"Atlanta, GA"},
 {"LocationCode":"12","LocationName":"Beltsville, MD"},
 {"LocationCode":"13","LocationName":"Boise, ID"},
 {"LocationCode":"14","LocationName":"Boston, MA"},
 {"LocationCode":"15","LocationName":"Box Elder, SD"},
 {"LocationCode":"16","LocationName":"Buena Vista, CO"},
 {"LocationCode":"17","LocationName":"Cape Elizabeth, ME"},
 {"LocationCode":"18","LocationName":"Carlsbad, CA"}
 ]

Upon clicking the checkbox in the filter grid, the client sends the following to the server to get the filtered data:
https://localhost:44357/Home/spGetUserList?pq_datatype=JSON&pq_filter={"mode":"AND","data":[{"dataIndx":"LocationName","dataType":"string","value":["Box Elder, SD"],"condition":"range"}]}&_=1650323597648

Our server expects the LocationCode value to be supplied instead of LocationName, but there seems to be no way to achieve this in the current version. People remember names not codes and we don't have space to include both columns. We have many such columns in the grid we use.
As I said in my previous reply, this used to be possible prior to version 5.2.0.

Cheers,
Geoff

Code: [Select]

$(function () {

    //define the grid.
    var oColModel = [
        {
            title: "Business Unit",
            dataIndx: "BusinessUnit",
            editable: false,
            width: 70,
            filter: {
                type: 'select',
                crules: [{ condition: 'range' }],
                selectGridObj: function (ui) {
                    buildFilterDropDown(ui, "/Home/GetBusinessUnits");
                },
                maxCheck: 1
            }
        },
        {
            title: "Sector",
            dataIndx: "Sector",
            editable: false,
            width: 80,
            filter: {
                type: 'select',
                crules: [{ condition: 'range' }],
                selectGridObj: function (ui) {
                    buildFilterDropDown(ui, "/Home/GetSectors");
                },
                maxCheck: 1
            }
        },
        {
            title: "Location", dataIndx: "LocationName", editable: false, width: 70, align: "center",
            filter: {
                type: 'select',
                crules: [{ condition: 'range' }],
                selectGridObj: function (ui) {
                    buildFilterDropDown(ui, "/Home/GetLocations");
                },
                maxCheck: 1
            }
        },
    ];

    //Set up ParamQuery data model
    var oDataModel = {
        dataType: "JSON",
        location: "remote",
        recIndx: "EmpCode",
        method: "GET",
        url: "/Home/spGetUserList",
        getData: function (response) {
            return { data: response };
        }
    }

    var obj = {
        height: 'flex',
        rowHt: 30,
        wrap: false,
        hwrap: false,
        editable:false,
        columnBorders: false,
        scrollModel: { autoFit: true },
        title: "<b>Header Filters</b>",
        colModel: oColModel,
        filterModel: {
            on: true,
            mode: "AND",
            header: true,
            type: "remote"
        },
        dataModel: oDataModel
    };
    var grid = pq.grid("#grid_array", obj);

    function buildFilterDropDown(ui, strControllerUrl) {
        //Gets the filter options from the supplied controller URL

        ui.obj.dataModel = {
            location: 'remote',
            url: strControllerUrl,
            getData: function (response) {
                var val = ui.column.filter.crules[0].value || [],
                    di = ui.column.dataIndx,
                    //data = response.data;
                    data = response;
                data.forEach(function (rd) {
                    if (val.indexOf(rd[di]) >= 0) {
                        rd.selected = true;
                    }
                })
                return { data: data };
            }
        }



    }
});

7
Hi,

Having read through the upgrade notes, I think I understand what is going on here now.
The ability to filter by a value as opposed to the displayed label went away in version 5.2.0.

Versions prior to 5.2.0. allowed the following filter object to work:

   filter: {
      type: 'select',
      condition: 'equal',
      valueIndx: "LocationCode",
      labelIndx: "LocationName",
      listeners: ['change']
}

Thus the value sent to the controller specified in the pq_filter parameter would have been the one in the LocationCode column.
Whilst the newer versions have many more features, filtering by valueIndx instead of labelIndx seem no longer to be possible.

Is this true?
If so, is there a work-around?
Is there a plan to reinstate this ability?

Cheers,
Geoff

8
Hi,
Perhaps it might help if I were to explain a little further:

Imagine a column that displays job titles, e.g. "Developer", "Analyst", "Database Administrator".
Associated with each of those values is a job code, e.g. "050", "055", "060".
The job titles and job codes are both columns in the dataModel.
I want the header filter to display the job title, but when a value is selected I want the pq_filter parameter to contain the job code.
Is this possible?

Cheers,
Geoff

9
Hi,

I am using remote header filters.
I would like to have the filter selection list display labels from its own column, but send values to the server to filter by, from another column.

So for example, in the request to the server, the pq_filter parameter currently sends:
{"mode":"AND","data":[{"dataIndx":"LocationName","dataType":"string","value":["Buena Vista, CO (V)"],"condition":"range"}]}
"Buena Vista, CO (V)" is the displayed value in that column.
I would like to send a value from a different (ideally hidden) column on the same row instead.

Cheers,
Geoff

10
Help for ParamQuery Pro / Re: https://jsfiddle.net/glt101/47m9fc8o/
« on: April 12, 2022, 02:29:20 am »
Thanks. That partially solved the issue.
I still had to add the following as well in a separate file:

Code: [Select]
\.pq-grid-title, .pq-group-header {
    background: #332985;
    border-color: #332985;
}
.pq-grid-row.pq-striped {
    background: #edecff;
}

.ui-widget-header {
    border: 1px solid #332985;
    background: #332985;
    color: #fff;
    font-weight: bold;
}

Cheers,
Geoff

11
Help for ParamQuery Pro / Re: https://jsfiddle.net/glt101/47m9fc8o/
« on: April 09, 2022, 12:45:04 am »
I see.
In the Pro Tutorial page you have the PQGrid css themes marked as optional so I had not included that:

Code: [Select]
    <!--ParamQuery Grid custom theme e.g., office, bootstrap, rosy, chocolate, etc (optional)-->
    <link rel="stylesheet" href="path to custom theme pqgrid.css" />

After I added that resource (see the same JSFiddle) it overwrites the jquery-ui custom theme.
Is it possible to have a jquery-ui custom theme and still have the freezeCols option work?

Cheers,
Geoff

12
Help for ParamQuery Pro / https://jsfiddle.net/glt101/47m9fc8o/
« on: April 07, 2022, 09:05:21 pm »
Hi,

I am having a problem using the freezeCols column option:

The right-most of the columns that are frozen get overlapped by the next column to the right when scrolling to the left.
See attached image and the following JSFiddle:

https://jsfiddle.net/glt101/47m9fc8o/

Cheers,
Geoff

13
Help for ParamQuery Pro / Re: Cascading remote header filters
« on: March 24, 2022, 11:54:43 pm »
That helps.
As you suggested I was able to get access the other columns by doing this:

Code: [Select]
                    selectGridObj: function (ui) {
                        buildFilterDropDown(ui, "/theControllerUrl", this.getColModel());
                    }
Filters cascade nicely now.
Cheers,
Geoff

14
Help for ParamQuery Pro / Cascading remote header filters
« on: March 24, 2022, 03:19:11 am »
Hi,

I have implemented header filters in the manner described here:
https://paramquery.com/pro/demos/filter_remote_options
The page correctly calls the server to obtain the list of filter options each time the filter list is displayed.

I now need to make the filter lists cascade.
To be able to do that I need to send the state of all the header filters on the page with each call to the obtain the current filter's filter options.
However, there doesn't seem to be a way to reference the other columns to obtain their currently selected filter option from within the selectGridObj function.
This is presumably because the full grid hasn't been created at that point.

How might I implement cascading remote header filters?

Cheers,
Geoff

Code snippet to show what I am trying to achieve:

Code: [Select]
   
obj.colModel =
        [
            {
                title: "Business Unit",
                dataIndx: "BusinessUnit",
                editable: false,
                width: 70,
                filter: {
                    type: 'select',
                    crules: [{ condition: 'range' }],
                    valueIndx: "BusinessUnit",
                    labelIndx: "BusinessUnitName",
                    gridOptions: {
                        filterModel: { header: false }
                    },
                    selectGridObj: function (ui) {
                        buildFilterDropDown(ui, "/theControllerUrl");
                    }
                },
                filterFn: function (ui) {
                    if (ui.condition == 'range') {
                        return {
                            maxCheck: 1
                        }
                    }
                }
            },
...
]

...

    function buildFilterDropDown(ui, strControllerUrl) {
        var strDataIndx = ui.column.dataIndx;
        var oData = { [strDataIndx]: ui.obj.dataModel.data[0][strDataIndx] || "" }; //Can only access the current column here. Need to send state of all other header filters too.
        ui.obj.dataModel = {
            location: "remote",
            getUrl: function () {
                return { url: strControllerUrl, data: oData };
            },
            getData: function (response) {
                var val = ui.column.filter.crules[0].value || [];
                var strDataIndx = ui.column.dataIndx;
                response.forEach(function (oOption) {
                    if (val.indexOf(oOption[strDataIndx]) >= 0) {
                        oOption.selected = true;
                    }
                })
                return { data: response };
            }
        }
    }

15
Help for ParamQuery Pro / Re: Hide textbox in header filter
« on: March 22, 2022, 09:35:39 pm »
Wow. No idea how I missed that  :o
Works fine - thanks.

Cheers,
Geoff

Pages: [1] 2