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_TopicIcon
a new event after changing the col width -> patch included!
16/07/2009
10:45
Avatar
ghum
Member
Members
Forum Posts: 11
Member Since:
17/05/2009
sp_UserOfflineSmall Offline

Hello tony,

thanks for the wonderfull jquery tool!   I have the need to remember changes to the width of columns of jQuery.

That is: changes done by the enduser, dragging and dropping the columns-separators.

I suggest adding a new event-Property onChangeWidth.

Documentation: onChangeWidth(index, newWidth) -> gets called everytime the width of one column is changed; default: null, nothing is done. Index is the index of the changed column, newWidth is the width after the change

That patch adds 3 lines to grid.base.js; the default is no cahnge in behaviour to now. I hereby submit this change to the Public Domain.

best wishes

Harald

diff --git a/js/grid.base.js b/js/grid.base.js
index 7fc3c4a..2635e78 100644
--- a/js/grid.base.js
+++ b/js/grid.base.js
@@ -43,6 +43,7 @@ $.fn.jqGrid = function( p ) {
     onRightClickRow: null,
     onPaging: null,
     onSelectAll: null,
+    onChangeColWidth:null,
     loadComplete: null,
     gridComplete: null,
     loadError: null,
@@ -156,6 +157,8 @@ $.fn.jqGrid = function( p ) {
                         this.sDiv.scrollLeft = this.bDiv.scrollLeft;
                     }
                 }
+            if($.isFunction(p.onChangeColWidth))
+                    {p.onChangeColWidth(idx, nw);}
             }
         },
         scrollGrid: function() {

20/07/2009
10:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks for this.

If you use 3.5 version this is not needed. When the width of some column is changed it is automatically updated in colModel. So in this case you just needs getGridParam.

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.

21/07/2009
19:37
Avatar
SteveT
Member
Members
Forum Posts: 14
Member Since:
08/06/2009
sp_UserOfflineSmall Offline

Actually, I was needing this very thing.  I was wanting some way to know if the user made any column adjustments.

With your event I could set a flag to dirty.  On the unload of the page if this flag is dirty I was going to ajax the new column widths to the server to save them.

23/07/2009
02:46
Avatar
ghum
Member
Members
Forum Posts: 11
Member Since:
17/05/2009
sp_UserOfflineSmall Offline

>If you use 3.5 version this is not needed. When the width of some column is changed it is automatically updated in >colModel. So in this case you just needs getGridParam.

Thanks for this information! 

But is there also an event fired that signals "hey, the user changed the width of some column" ?

Because that was the main reason for my patch, I need to get noticed that the colModel has changed. 

best wishes,

Harald

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
47 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