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

Pages: [1] 2 3 ... 10
1
Help for ParamQuery Pro / Re: Horizontal scroll bar scrollModel issue
« on: February 11, 2025, 05:09:19 am »
Just to help others, I accomplished this by doing the following:

Code: [Select]
new ResizeObserver(function(){ grid_resize(); }).observe( grid );

grid_resize()
{
if(grid && grid.is(":visible"))
{
// Do we add horizontal scroll
var width = 0;
grid.pqGrid("Columns").each(function(col){
if(!col.hidden)
width += intval(col["width"]);
});

// Do we hide or show the scroll bar
grid.pqGrid("option", "scrollModel", {autoFit:width<grid.width() ? true : false});
}
}

2
Thanks. Can't believe I missed that.

3
I have a grid with dataModel.location="remote"

Just on the first load (one off when data loaded for the first time only) I want to set an initial filter on a column.  So when refresh, add/remove filters, etc. it must NOT revert to the initial filter option.

I want to avoid calling the remote server twice.

After building the table, I have tried making the dataModel.location="local", applying the filter then dataModel.location="remote" which works, but is there a cleaner way to set the initial filter in "options"?

I have tried using grid.one like below, however this calls the remote server to load the data twice, being one time to load the initial data (unfiltered) then again after the "one" is called with a new filter.

Code: [Select]
grid.one("load", function (evt, ui) {
// Apply initial filtering.
grid.filter({
oper: "add",
rules: [
{ dataIndx: "DEPOT", value: ["London"] },
]
});
});

4
Help for ParamQuery Pro / Do not show the message "No rows to display"
« on: January 19, 2025, 02:16:47 am »
When a grid has no data, I want to hide the text "No rows to display" that appears in some grids.  How do I do this withou changing the locale files as I don't want to do this for all grids?

5
Help for ParamQuery Pro / Re: Inheritance for cVirtual
« on: January 13, 2025, 11:33:29 pm »
Please can you respond to this support request

6
Help for ParamQuery Pro / Inheritance for cVirtual
« on: January 03, 2025, 07:27:21 pm »
I want to override functions calcTopBottom, getTop, getLeft, etc. which is in  window.pq.cVirtual.

I am using the jQuery version of pqGid, so to overwrite some functions I use the following which works fine:

Code: [Select]
(function($) {
var fn = $.paramquery._pqGrid.prototype;
fn.showLoading = function() {
if(this.$grid_center.is(":visible"))
{
this.loading = true;
open_loading_overlay();
}
};
fn.hideLoading = function() {
this.loading = false;
close_loading_overlay();
};
})(jQuery);

However when I want to override cVirtual functions, to test this I do the following:

Code: [Select]
var cVirtual = window.pq.cVirtual.prototype;
cVirtual.calcTopBottom = function(left) {
console.log("calcTopBottom");
// Call the old
return cVirtual.calcTopBottom(left);
};
cVirtual.getTop = function(ri, actual) {
console.log("getTop");
// Call the old
return cVirtual.getTop(ri, actual);
};
cVirtual.getLeft = function(ci, actual) {
console.log("getLeft");
// Call the old
return cVirtual.getLeft(ci, actual);
};
cVirtual.getHeightR = function(ri, rows) {
console.log("getHeightR");
// Call the old
return cVirtual.getHeightR(ri, rows);
};
cVirtual.calInitFinal = function(top, bottom, left) {
console.log("calInitFinal");
// Call the old
return cVirtual.calInitFinal(top, bottom, left);
};

However the above functions are never called.  What am I doing wrong?

7
Bug Report / Another bug for hidden grids (with fix)
« on: January 03, 2025, 06:05:19 pm »
If the grid is hidden when data is loaded, to fix I added the following:

Code: [Select]
getHeightR: function(ri, rows) {
if(typeof(ri)==="undefined") return 0;
...

getHeightCell: function(ri, rows) {
if(typeof(ri)==="undefined" || ri<0) return 0;

In the case above, I opened the grid, scrolled down a lot, closed the grid, new data was loaded and it went wrong trying to show it.

The pqGrid code has been written assuming that the grid is visible when data is loaded or a refresh is called.  This is obviously not always the case as sometimes the grid is prepared in the background for a better user experience.

8
Suggest new features / Re: Quick and simple documentation request
« on: December 03, 2024, 07:54:21 pm »
Please could you do this on the demos page as well (https://paramquery.com/pro/demos) as once I select a demo, the title bar scrolls off here as well.

9
Bug Report / Touch/hover style bug
« on: November 25, 2024, 08:02:54 pm »
This is a minor bug

When the option below is set:

selectionModel: { type:"row", mode:"single", column:false, all:false, toggle:false},

when you touch and move away from a row (like slide or roll your finger on the screen) but not select the row, the hover highlight stays on the row (see attached image) so eventually you end up with lots of rows highlighted.  This is the same on iPhone and Android.

10
Bug Report / Re: Safari 16 and below bug with suggested fix
« on: November 25, 2024, 07:58:26 pm »
Just to add, this is serious as v10.1.0 will not load on Safari 16 or below because of this.

11
Bug Report / Safari 16 and below bug with suggested fix
« on: November 25, 2024, 06:15:50 pm »
In pqgrid.dev.js from 3212:

Code: [Select]
/*BUG*/
//fmtPart = fmtPart.replace(/(?<![ap])m{1,5}/gi, replacer("M"));
/*SUGGESTED FIX*/
fmtPart = fmtPart.replace(/(?:^|[^ap])m{1,5}/gi, function (match, offset, string) {
// Ensure the match doesn't follow 'a' or 'p'
if (offset === 0 || !/[ap]/i.test(string[offset - 1])) {
return replacer("M")(match);
}
return match;
});

Safari 16 does not accept the regex "/(?<![ap])m{1,5}/gi" because it does not support "<"

Please confirm the suggested fix is OK, if not, please tell me what it should be replaced with.

12
Bug Report / Re: Listener bug in v10.1.0
« on: November 20, 2024, 07:36:09 pm »
Also just to mention, if I just set the "keydown" listener, the "timeout" normal course of things stops being triggered

13
Bug Report / Re: Listener bug in v10.1.0
« on: November 20, 2024, 03:58:22 pm »
Thanks for adding this, I have removed all of the code.

However I feel it is my duty to still report there is still a bug there.  I added the listener code as this:

var listener = {
   "keydown": function(e, ui)
   {
      console.log("keydown", e);
   },
   "timeout": function(e, ui){
      console.log("timeout",e);
   }
};

When I typed the name "David" (no [Enter] key pressed) I got the attached result.  As you can see, timeout is getting called for keydown events, sometimes it is the other way round.

14
Bug Report / Listener bug in v10.1.0
« on: November 19, 2024, 11:59:46 pm »
I had a listener that previously worked.  The idea of the listener is that the filter starts either when the [ENTER] key is pressed or the timeout happens. v10.0.0 and below worked fine, v10.0.1 now has an issue, in that every keypress, the filter starts due to the timeout.

If I comment out the "timeout", it works fine except the timeout is never triggered.  If I include the timeout, it goes all wrong.

Ideally I would like to avoid using the "do_filter" function and just use the default filter start trigger, but I don't know how to call that.

Code: [Select]
var text_listener = {
"keydown": function(e, ui)
{
if(e.key==="Enter")
do_filter(ui);
},
// If I comment out below for v10.0.1 there are no wrong filter triggers
"timeout": function(e, ui){
do_filter(ui);
}
};

function do_filter(ui)
{
var rule = { condition: ui.column.filter.crules[0].condition,  dataIndx: ui.column.dataIndx, value: ui.value, value2: ui.value2 },
CM = $("#grid").pqGrid("getColModel");

// Check if the filter is not already applied
for(var i=0, len = CM.length; i < len; i++){
// If there is no change
if( CM[i]["dataIndx"]===ui.column.dataIndx && ui.value===CM[i]["filter"]["crules"][0]["value"] && ui.value2===CM[i]["filter"]["crules"][0]["value2"] )
rule = null;
}

// If we have a rule, apply it
if(rule)
$("#grid").pqGrid("filter", {
oper: "add",
rules: [
rule
]
});
}

...

columnModel = [
{dataIndx:"NAME", title:"NAME", filter:{crules:[{condition:"contain"}], style:"text-align:"+dir, listener:text_listener}},
...
];

Doing a console log I found the bug.  The timeout in the listener is getting the "keydown" event and not getting the "timeout" event.   I commented out the "keydown" listener and timeout worked.

I tried below, but either keydown or timeout get missed:

Code: [Select]
var text_listener = {
"keydown": function(e, ui)
{
if(e.type==="keydown" && e.key==="Enter")
do_filter(ui);
},
// If I comment out below for v10.0.1 there are no wrong filter triggers
"timeout": function(e, ui){
if(e.type==="timeout")
do_filter(ui);
}
};

I shouldn't have to test for the event as that function should never be called for a different event.

15
Bug Report / Tiny bug in v10.0.1
« on: November 19, 2024, 09:27:14 pm »
If the grid is created inside a hiden parent (parent hidden before grid created, like a jquery UI dialog), errors occure unless the following code is added:

getTop: function(ri, actual) {
   var top = this.topArr ? this.topArr[ri] : 0,
         ....

getLeft: function(_ci, actual) {
   if(typeof(this.leftArr)==="undefined") return 0;
        ....

calcTopBottom: function(left) {
   if(typeof(this.dims)==="undefined") return 0;
   ...

Pages: [1] 2 3 ... 10