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
cell editing of grid having subgrids as grid
23/10/2011
12:46
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

there are a bug in cell editing of grid having subgrids as grid. If cell of subgrid will be clicked the click event will be fire twice: one for the subgrid and one more time for the main grid. The reason is easy – both grids have registerd click event (see the line 2276 of grid.base.js). The problem is that click event in the main grid will be wrong processed. Firsts it will be found <tr> element

ptr = $(td,ts.rows).closest("tr.jqgrow");

in the subgrid and then will be calculated indexes

ri = ptr[0].rowIndex;
ci = $.jgrid.getCellIndex(td); 

also in the subgrid, but the next line

try {$(ts).jqGrid("editCell",ri,ci,true);} catch (_) {}

uses the indexes from the subgrid to start editing of the cell in the main grid. So instead of editing of one cell in the subgrid one start additionally editing one more cell in the main grid.

In my opinion the easiest way to fix the problem is just to ignore the click event which is fired in the subgrid during click processing in the main grid. One can do this for example by changing the line 2279 of grid.base.js from

if($(ptr).length === 0 || ptr[0].className.indexOf( 'ui-state-disabled' ) > -1 ) {

to

if($(ptr).length === 0 || ptr[0].className.indexOf( 'ui-state-disabled' ) > -1 || $(td,ts).closest("table.ui-jqgrid-btable")[0].id !== ts.id) {

The bug can one see live on the demo. After the bug fix the editing work correct (see the fixed demo).

The bug and the fix is described in my answer here.

Best regards
Oleg 

25/10/2011
12:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Oleg,

Thanks again,

This seems reasonable, but what about when we have 3 and more  levels subgrids ?

Should think

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.

25/10/2011
13:21
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

the fixed demo seems work good with many level of subgrids. Which problem you see here? What behavior you expect and what you see?

Regards
Oleg 

10/11/2011
12:44
Avatar
0xFF
Poland
Member
Members
Forum Posts: 28
Member Since:
28/02/2011
sp_UserOfflineSmall Offline

Hello, 

Is this bug already fixed in git repo?

Nasty bug! It took me few days of digging around what's is wrong with my code 😉

Thanks for great plugin, and looking forward for the fix 😉

Best regards 

Piotr

11/11/2011
13:17
Avatar
paulmcgarry
Ireland
New Member
Members
Forum Posts: 2
Member Since:
12/10/2010
sp_UserOfflineSmall Offline

UPDATE :

Realised my problem.

Went back to the source file, made the change, and minified it.

Solved. Thanks for the bug fix.

Regards

Paul.

------------------------------------------

Hi OlegK

I am having this problem.

I downloaded the latest version of jqGrid (4.2) today which I don't think contains the fix.

I searched for the LINE you mentioned should be changed, but could not find it.

Wondering which version should I be working with, in order to get this working…?

Either to be able to apply the fix, or find one that contains the fix?

I use the file jquery.jqGrid.min.js which contains all code, for all options – As downloaded with all options selected.

Can you help?

Regards Paul


11/11/2011
13:54
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Paul,

if you need make any modifcation in the jqGrid code you need use jquery.jqGrid.src.js instead of jquery.jqGrid.min.js. If you really need to use the file in production you can create minimized version of the file yourself. To do this you can choose any your favorite minifier. Just search in internet for the words JavaScript and minifier and you will find many versions from there. Every has its advantages and disadvantaged. The first well-known minifier was JSMin. There are Closure CompilerMicrosoft Ajax Minifier, YUI Compressor, and so on.

You can compare the results of different minifires here. Corresponds to the tests the best restults you will get with the Closure Compiler. In case of the usage of jquery.jqGrid.min.js on the web server with enabled compression you need look at the size of GZIPed version of the file.

In my experiments with the current version of Closure Compiler

java -jar compiler.jar –compilation_level ADVANCED_OPTIMIZATIONS –js=jquery.jqGrid.src.js –js_output_file=jquery.jqGrid.min.js

I got file jqGrid.min.js with the size 185.981 bytes. It's better as 239.659 bytes of the jquery.jqGrid.min.js from trirand download. The problem with the usage ofADVANCED_OPTIMIZATIONS parameter that to use it correct one need create the list of extern methods (see here). Only after that one will have not only small, but also working code. If you don't want invest your time in creating the list of extern methods you can use Microsoft Ajax Minifier. In my tests the ms-minimized version of jquery.jqGrid.src.js has the size 234.088 and gziped: 64.546 which is smaller as 239.659 and 66.938 correspondingly for jquery.jqGrid.min.js from trirand download.

@Tony: If you find time you can play a little with Closure Compiler. Probably you can use it in the official jqGrid download package?

Best regards
Oleg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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