Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

footerData destroy frozen cols when it's inside jqGridAfterLoadComplete event #1071

Open
fredsal opened this issue Oct 9, 2024 · 8 comments

Comments

@fredsal
Copy link
Contributor

fredsal commented Oct 9, 2024

This worked in previous versions, it is a breaking change?

v5.8.8
Demo: https://jsfiddle.net/x05efgj6/2/ (try moving horizontal scrollbar, there is no frozen cols, but there is frozen header)

image

// here is the event
$("#jqGrid").on('jqGridAfterLoadComplete',()=>{  		
    // here destroys frozen columns
    // I change it dynamically because I put a value that I recalculate in each `jqGridAfterLoadComplete`
   $("#jqGrid").footerData('set',{CategoryName:'MyFooter'})
});

This worked without problems before, am I doing something wrong??


I did found the problem, now there is destroyFrozen arg on footerData method

footerData : function(action,data, format, index, destroyFrozen) {

and it is true by default
if(destroyFrozen === undefined) { destroyFrozen = true; }

@tonytomov
Copy link
Owner

Glad to hear you have found a solution.
Sorry for the late response

@angeljqv
Copy link

Sorry for the late response

Don't worry, you have a personal life like everyone else.

you have found a solution

I did found the problem, but it seems like a breaking change, this change was quite unexpected

@tonytomov
Copy link
Owner

Actually there is a option userDataOnFooter which actually do the same you do.

If you really need this maybe you will need to call the command within setTimeout.

Regards

@angeljqv
Copy link

you will need to call the command within setTimeout.

It is to simulate an ajax call, which is the moment where the problem happens, without ajax nothing happens

there is a option userDataOnFooter which actually do the same you do.

In the example, userDataOnFooter is being used, or am I using it wrong?
Because I get the footer data from the FRONT

@tonytomov
Copy link
Owner

tonytomov commented Nov 12, 2024

If you comment the code in jqGridAfterLoadComplete everthing will be ok. In this case you call it two times one after other. Please look this code in the source: https://github.com/tonytomov/jqGrid/blob/master/js/grid.base.js#L3192

The same apply to JSON data.

@tonytomov
Copy link
Owner

Sorry I mean you will need to comment the event and stay only with the lines like this:

$("#jqGrid").jqGrid({
    datatype: "local",
    mtype: "POST",
    colModel: [
      { label: 'Category Name', name: 'CategoryName', width: 75, frozen:true },
			{ label: 'Product Name', name: 'ProductName', width: 300 },
			{ label: 'Country', name: 'Country', width: 200 },
			{ label: 'Price', name: 'Price', width: 80 },
			{ label: 'Quantity', name: 'Quantity', width: 80 }                   
		],		
		width: 450,height: 200, autowidth:false, shrinkToFit:false,
    footerrow:true
  });
  $("#jqGrid").footerData('set',{CategoryName:'MyFooter'})
  $("#jqGrid").jqGrid('setFrozenColumns');

};

@angeljqv
Copy link

angeljqv commented Nov 12, 2024

Sorry I mean you will need to comment the event and stay only with the lines like this:

Yes that works, I'll try to explain myself again

// I change it dynamically because I put a value that I recalculate in each jqGridAfterLoadComplete

I reload the ajax grid periodically, I set footerData on every load, I make calculations based on an indicator entered in the FRONT END, so, the footer is not fixed like the example, i set fixed word 'MyFooter' just for show the problem

with frozen columns, footerData on jqGridAfterLoadComplete fails, loadComplete option also fails

This worked correctly in previous versions, look: https://jsfiddle.net/jLycz4kg/
Also, one part is frozen and the other is not, it looks like a bug.

here I used setInterval, so you can see the footer change: https://jsfiddle.net/vj9Lfe56/1/

@angeljqv
Copy link

using jqGridAfterGridComplete, first ajax load fails, second works look: https://jsfiddle.net/0rh7setf/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants