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 - paramvir

Pages: [1] 2 3 ... 428
1
Help for ParamQuery Pro / Re: Default state
« on: August 27, 2025, 08:42:36 pm »
Yes, it’s possible to implement a “Set as Default” button in the toolbar using the saveState and loadState APIs. Here’s the approach:

Save the selected state as a string
When the user clicks your “Set as Default” button, call saveState and save the returned string somewhere persistent—like local storage or your database. For example:

Code: [Select]
const defaultState = grid.saveState({ stringify: true });
localStorage.setItem('myGridDefaultState', defaultState);

Load this default state on page load
On page load, retrieve the saved state string and pass it to loadState:

Code: [Select]
const savedState = localStorage.getItem('myGridDefaultState');
if (savedState) {
    grid.loadState({ state: savedState, refresh: true });
}

2
This is how you can define a custom aggregate to round the numbers before aggregating them.

Code: [Select]
pq.aggregate.sumRound = function(arr, col) {
   let rounded = arr.map(val => parseFloat(Number(val).toFixed(2)));
   return pq.aggregate.sum(rounded, col);
};

Now sumRound can be used in groupModel as

Code: [Select]
agg: {"PRICE":"sumRound"}

3
Bug Report / Re: Very, very minor bug for depricated JS
« on: August 24, 2025, 10:42:25 pm »
there is no need to use filesaver.js

pq.saveAs API can be used: https://paramquery.com/pro/api#method-saveAs

4
Help for ParamQuery Pro / Re: Drag & drop rows without the diDrag icon
« on: August 04, 2025, 04:27:13 pm »
sortable + pqgrid also works with selectionModel: {type: 'row'}

however in pqgrid native DnD, a row can't be dragged without a drag helper / icon.

5
Help for ParamQuery Pro / Re: Drag & drop rows without the diDrag icon
« on: August 01, 2025, 08:15:36 pm »
jQueryUI sortable doesn't work with virtualized DOM so the whole rows need to be rendered in view.

The selectionModel.type needs to be turned off to give the mouse control to sortable.

The following is a quick sample of sortable with pqgrid.

https://jsfiddle.net/us7kmz21/

6
Help for ParamQuery Pro / Re: How do I undo a moveNode event
« on: August 01, 2025, 02:57:08 pm »
Drag-and-drop operations in a treegrid support undo and redo functionality.

Although undo is not currently available in the plain grid, this capability is being introduced in the upcoming release.

9
Your code is fine, please use this patch before initialization of grids to fix the issue:

Code: [Select]
(function(){
let _p = pq.parseDate;
pq.parseDate = function(fval, ...args) {
if (!fval || typeof fval != 'string' || fval.trim() == ''){
return '';
}
return _p.apply(this, arguments);
}
})();

10
Have you specified fmtDateEdit option in your grid initialization object?

https://paramquery.com/pro/api#option-fmtDateEdit

11
non filter cells in filter row are not configurable, however following workaround can be used:

Code: [Select]
filter:{
crules:[{condition:'equal'}],//use some condition.
init: function(ui){
ui.$cell.html("Empty");//insert custom html.
return true;
}
}

12
There's no equivalent in plain grid.

rowData can be obtained from id as:

Code: [Select]
const row = grid.option('dataModel.data').find(r => r.id === '1234');

for performance-critical code, creating a lookup object as mentioned by you is most efficient way to get row data from id.

13
this is incorrect: ui.rowData can't be passed as newRow param of updateRow method.

Create a new object {} containing only the changes to pass it as newRow param.

Please check the documentation:

https://paramquery.com/pro/api#method-updateRow

14
Help for ParamQuery Pro / Re: Column filter on remote source override
« on: July 15, 2025, 06:19:11 am »
Setting return false in the beforeFilter event effectively prevents filtering by canceling the remote data request.

You can verify this behavior by using the above code in the example: https://paramquery.com/pro/demos/filter_header

If you're still encountering issues, feel free to share a JSFiddle for further assistance.

15
Help for ParamQuery Pro / Re: Column filter on remote source override
« on: July 14, 2025, 03:27:05 pm »
beforeFilter event can be used to hook into filter for specific column(s). return false in this event cancels the remote filter request.

Code: [Select]
beforeFilter: (evt, ui)=>{
if(ui.rules.find(rule=> rule.dataIndx == 'ShipCountry')){
                //do your thing..
return false; //cancel filtering.
}
},

Pages: [1] 2 3 ... 428