free-jqgrid / jqGrid

jQuery grid plugin
https://github.com/free-jqgrid/jqGrid
Other
480 stars 196 forks source link

Part of jqGrid is broken #3

Closed johncze closed 9 years ago

johncze commented 9 years ago

Hi Oleg :)

A) Yesterday I crossed to your jqGrid version, but part of jqGrid is not work. I included jquery.jqGrid.src.js and I used sortableRows function in previous version jqGrid (official release 4.7.0.). Now browser throws exception:

Uncaught TypeError: Cannot read property 'NumberFormat' of undefined

, but NumberFormat function is contained in jquery.jqGrid.src.js. So I included jquery.fmatter.js. After JqGrid throws:

Uncaught TypeError: Cannot read property 'sortableRows' of undefined

Then I looked at source jquery.jqGrid.src.js and jquery.jqGrid.min.js and part of source is commented in Netbeans and Sublime Text. The error is probably on line 10614 see https://github.com/OlegKi/jqGrid/blob/master/js/jquery.jqGrid.src.js#L10614. The source is commented from 10614 line. This same problem in jquery.jqGrid.min.js.

B) Should I include initFontAwesome and autoWidthColumns or both are contained in your version jqGrid ? After must I call

$("#table").jqGrid("initFontAwesome ").jqGrid("autoWidthColumns ");

before $("#table").jqGrid(options) ? I don't know if I should include plugins or plugins are contained in current your version jqGrid.

Many thanks,

Daniel

johncze commented 9 years ago

to A) Now I found solution. The problem was that I don't include jquery.ui, because default version of jqGrid not required jquery.ui. You could write this requirement into README, please.

OlegKi commented 9 years ago

Hi!

Thank you for your feedback.

A) The method sortableRows is old jqGrid method described here. It needs jQuery UI JavaScript file (not only CSS file).

B) You should not use more autoWidthColumns plugin. I wrote it before for jqGrid 4.6/4.7, but I was not satisfied with the performance. So I rewrote it full. Now it's a part of my fork of jqGrid. To activate it you need to do the following 1) define autoResizable: true property in all columns of colModel which could be resizeable. You can use cmTemplate: { autoResizable: true } option of jqGrid to set the property in all columns. 2) Include autoresizeOnLoad: true options of jqGrid. There are exist some additional options which allow to change a little the algorithm used to calculate the "optimal" column width. See demos at the end readme as examples.

B) To use initFontAwesome you need use $("#table").jqGrid("initFontAwesome") (without the space at the end of the function name: "initFontAwesome ", see exactly the text of your question). It's important only that you use the files jQuery.jqGrid.fontAwesome4.css and jQuery.jqGrid.fontAwesome4.js from plugins folder of NEW jqGrid (I mean from my fork of jqGrid).

If you would report bugs in the future, please include 1-3 lines of code with the error. I publish currently many changes in the day so the links like https://github.com/OlegKi/jqGrid/blob/master/js/jquery.jqGrid.src.js#L10614 will point to another line.

Best regards Oleg

johncze commented 9 years ago

Hi,

thank you for your detail description.

1) Ok, I removed autoWidthColumns plugin. I looked at http://www.ok-soft-gmbh.com/jqGrid/OK/autoresizeOnLoad1.htm demo, but it seems is different against autoWidthColumns, because If I will write into client column long text, then I will save row. So column won't be resizable according to his content. Please match with http://www.ok-soft-gmbh.com/jqGrid/AutowidthColumn3.htm demo. This behavior was implemented in autoWidthColumns plugin. Is it possible to do it in this current version ?

2) Sorry, but I use $("#table").jqGrid("initFontAwesome") without space of cource. The space was mistake during copy & paste :) I use jQuery.jqGrid.fontAwesome4.css and jQuery.jqGrid.fontAwesome4.js from new jqGrid from you. But browser still throws:

Uncaught TypeError: Cannot read property 'multiselect' of undefined
Uncaught jqGrid - No such method: initFontAwesome

and I don't know why, because initFontAwesome is included before creating jqGrid this way:

$("#table").jqGrid("initFontAwesome");
$("#table").jqGrid(myOptions);

and I don't understand why multiselect is required, because old jqGrid (4.7.0) this exception didn't throw. Multiselect is set to false in my options.

Ok, I will include more lines in the future.

Many thanks,

Daniel

OlegKi commented 9 years ago

Sorry Daniel, but you didn't included any URL to your demo, so I can't reproduce the problem. I suppose that you use jqGrid with wrong parameters or includes wrong JavaScript files.

Compare the demo which uses new version of jqGrid with the old demo. I don't see any problem. I included autoResizing: { maxColWidth: 1024 } option to increase the default 300 restriction for the maximal width of the resized column to display full texts in "Notes" column.

In the same way the demo or this one uses fontAwesome4 and I can't reproduce any problems which you describe.

So please post always the demos which reproduces the problem if you report a problem.

Best regards Oleg

johncze commented 9 years ago

Ok, many thanks. Now it is ok. The mistake was that I still use old plugins. I removed them and now your new version of jqgrid works.