Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
updateColumns deprecated in >3.8, is there a replacement to fix header widthing issue?
10/08/2013
15:22
Avatar
vr6
New Member
Members
Forum Posts: 2
Member Since:
09/08/2013
sp_UserOfflineSmall Offline

Apologies if this was already posted, but I am unable to find the post...

Or how to deal with this correctly

 

I am saving user grid preferences and restoring the grid.  The last step is to perform a remapColumns so that it correctly displays the order of the saved columns based on user preferences.  This works fine, both the column headers and the column data are in the correct order and place.  

HOWEVER, what is wonky is the following.  Say I have three columns Name (width: 200), Id (width: 70), Alert (width 60)

Name   Id         Alert  ==>    after the remap are in this order  ==>      Id        Name   Alert  

 

As stated previous the reorder is fine and each column contains the correct data BUT what is happening is that the Id column-header now has a width = 200 (incorrect width), but the Id column-data width = 70 (correct width) and the Name column-header has a width = 70 (incorrect width) but the Name column-data width = 200 (correct width).  The Alert column is unaffected and is correctly sized width in both column-header has width = 60 (correct width) and column-data has width = 60 (correct width).

I saw in the documentation there was an updateColumns method that would have likely help me fix the issue.  

updateColumns                 

 

 

this synchronizes the width of the headers with the data. Useful when used with table drag and drop. This method should be used this way - Example: 
var mygrid=jQuery(”#grid_id”)[0];
mygrid.updateColumns();

 

However as of jqGrid 3.8 it is deprecated.  We are using jqGrid version 4.4/4.5.  Where can I find jqGrid source code 3.7 so I can take a look at this method and possibly use it and/or how in the world can I fix this maddening issue using the current version of the software?

 

Hopefully this description is clear. My office blocks access to sites like pastebin otherwise I would post a clear visual of the issue. 

30/10/2013
21:09
Avatar
mcw0933
New Member
Members
Forum Posts: 1
Member Since:
30/10/2013
sp_UserOfflineSmall Offline

I was having a similar issue.

I have a local json data set that contains multiple grid row arrays.  These arrays all follow the same colModel.  I am using client-side logic to swap an array into the grid when the user chooses one to view, like so:

grid.clearGridData().setGridParam({ data: this.Config.data }).trigger("reloadGrid");

(grid is a jQuery object that has previously been initialized with:)

grid.jqGrid({config})

This works just dandy until I encounter an empty array.  After updating the grid with that empty array, when I would do the next switch, the data dropped into the grid was not aligned with the column headers, very much like the OP's issue.  (The ASCII representation of OP's issue on StackOverflow helps! Wink)

It turned out my issue was not with the colModel or the new data at all.  Instead, with empty data, I had some code that was dropping in a custom tr/td with "None" to make it clear to the user there was no data.  In that code, I was hiding the spacer row that is inserted, .jqgfirstrow, like so:

grid.find(".jqgfirstrow").hide();

... which I didn't really need to be doing.  My guess is that the td's of that row preserve the width values in the event of transitions like this.  So by hiding it I was blowing away the width hints.  I'm not doing that anymore, and it's working just dandy.

Not sure if this is at all helpful, OP - I spent a good while looking at updateColumns myself before I got here and finally (just now) figured this all out.  Too bad the wiki page doesn't call this method out as deprecated.

01/11/2013
09:31
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thank you for investigation and posting you opinion.

I feel ther is a problem with clearGridData.

Can you please set the jqGrid option deepempty to true and see if the problem persist

Thank you.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
92 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information