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
row dragndrop reordering vs header column width
24/04/2010
11:34
Avatar
szhbug
Member
Members
Forum Posts: 7
Member Since:
24/04/2010
sp_UserOfflineSmall Offline

I have a basic grid (loaded via url property, datatype=json) and enabled row drag-n-drop as specified in documentation, i.e.:

$("#table_t").tableDnD({scrollAmount:0})

gridComplete: function() {
     $("#_empty","#table_t").addClass("nodrag nodrop");
     jQuery("#table_t").tableDnDUpdate();
},

and it works, however if I drag the first row out of the first place, column width of all the rows immidiately changes and does not match column widths in the header! 

I have the width of the table well over the sum of the default width of the columns

If I later move the original first row into the first place - then everything become ok again(header column width == table column width), even if I change the header column width in the mean time.

I investigated the problem - jqgrid assignes the width value only to the original first row, all others have empty width value; so if after drag-n-drop it becomes non-first (2 cases: move the first out or move some other to the first place),  the column widthes resize to some defaults which do not correspond with the jqgrid table header which is another table in html. 

note: I have the width of the table well over the sum of the default width of the columns.

Even more, when resizing the header columns, jqgrid updates the column width of the ORIGINAL first row, not the current first row, which is also wrong, as it does not sync the column width.

I fixed the problem using following hack, but that is a little bit ugly way:

loadComplete: function(req){
    $("#table_t").tableDnD({
         onDragStart: function(tbl, dragrow) {
             var rh = $("#gview_table_t"+" table.ui-jqgrid-htable thead tr").get(0);
             var rows = tbl.tBodies[0].rows;
             var rfix = rows.length > 1 && rows[0].id == dragrow.id ? rows[1] : dragrow;
            for(var c=0; c < rows[0].cells.length; c++) {
                 rows[0].cells.item(c).style.width = 

                   rfix.cells.item(c).style.width =  //drag row may become the first

                       rh.cells.item(c).style.width;
             }
         },

P.S. 

versions:

jquery-1.3.2.min.js

jquery-ui-1.7.2.custom.min.js

jquery.tablednd_0_5.js

jqGrid  3.6.4

Firefox 3.5.9

29/04/2010
11:56
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks for this and it is true.

The tableDnD is no more supported. Insted use sortableRows method (provided with the grid jquery ui addons)

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:
42 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