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 ... 9
1
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

2
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.

3
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.

4
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;
   ...

5
Suggest new features / Re: Quick and simple documentation request
« on: November 19, 2024, 07:41:45 pm »
 :) Thank you for doing this.  It's the little things that make things great.

6
I spotted this on a mobile when I turned it to portrait.

My page has a bunch of text and images then the grid on the bottom of the page.  My grid has minimum height, so turning portrait might mean the lower rows are off the screen and a screen (not grid) scroll up needed to show the rest of the grid. 

ISSUE: I load the screen portrait and due to the height of my top section, I can only see the top row of my grid. When I do a page scroll (not grid scroll), the rows that were off screen are blank, unless I refresh or even do a grid scroll then the rows appear.

I'll try and get a demo up tomorrow.

7
On the column filter when it is a single line text, add an "X" or make it type="search" instead of type="text".

I tried making them type="search", however when clicking the "X" it doesn't trigger the filter.

8
Suggest new features / Re: Quick and simple documentation request
« on: October 30, 2024, 03:36:25 pm »
Sorry, misseed the top bit

Code: [Select]
<nav class="navbar navbar-default" style="position:sticky; top:0;">
Adding 'style="position:sticky; top:0;"' also looks better and doesn't leave the blank space above "+ Options"

9
Suggest new features / Re: In Render allow jQuery object to be returned
« on: October 29, 2024, 11:22:26 pm »
I might want to return something like:

Code: [Select]
var  that=this,
      jq = $("<span>", {html"O"})
   .click(function(e){ that.do_something(this); })
   .data("dta", {"id":2, "name":"O"})
   .add(
       $("<span>", {html"X"})
       .click(function(e){ that.do_something_else(this); })
       .data("dta", {"id":2, "name":"O"})
   );

return {jquery: jq};

I can't do above passing HTML.

10
The listeners work (I have made them work), and I have done them, but an option would be easier and would 100% work on new versions.

I also had to write the code below to prevent from doing 2 remote calls for the same filter, the second being triggered by the timeout:

Code: [Select]
var rule = { condition: ui.column.filter.crules[0].condition,  dataIndx: ui.column.dataIndx, value: ui.value, value2: ui.value2 },
CM = this.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)
this.grid.pqGrid("filter", {
oper: "add",
rules: [
rule
]
});

The issue is that with new versions, the above might end up not being compatible.

Also you promised to add the "X" in the column input filter to clear the text.  When you do this, my code might end up being incompatible.

11
Suggest new features / Re: Customise the "showLoading"
« on: October 29, 2024, 11:05:57 pm »
My current way of doing it is:

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);

It's not an issue to do above, but an easier way would be nice and it would be standard across versions.

12
Bug Report / Re: Please change one line of code in next version
« on: October 29, 2024, 11:01:03 pm »
If you need the code:

Code: [Select]
$("#grid").pqGrid("showLoading").pqGrid("refreshDataAndView");

13
Bug Report / Re: Please change one line of code in next version
« on: October 29, 2024, 06:44:41 am »
Found the bug.  It is caused by calling "showLoading" before loading remote data.

The issue is that this.loading is true, but at this point there is no XHR, thus the bug and the reason the fix works.

14
Bug Report / Re: BUG v.10.0.0 filter.title
« on: October 29, 2024, 06:32:29 am »
Tried this but no success on the error

https://jsfiddle.net/v0418zyj/3/

15
Bug Report / Re: Another v10.0.0 bug with fix
« on: October 29, 2024, 06:06:54 am »
Found out how to get the bug

https://jsfiddle.net/v0418zyj/1/

Before you click the show button, open the browser console then resize the screen.  You will see the error:

Uncaught TypeError: Cannot read properties of undefined (reading 'htContClient')

To fix this and other similar ones when the grid is hidden:


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

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

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

Pages: [1] 2 3 ... 9