1

Oleg, please check again http://jsfiddle.net/9ezy09ep/11/

When number of rows is large, scroll horizontal is positioned incorrectly.

Another problem is with bindKeys.

jQuery("#intrari").jqGrid('bindKeys', {"onEnter":function( rowid ){

}});

David O.
  • 97
  • 1
  • 10

1 Answers1

0

I posted just now the changes which fixes the calculation of grid width in case when vertical scroll bar exists. Now the JSFiddle demo which you posted works correctly.

You should post more clear question in the future (with the clear description of the problem) and you should don't post more as one questions at once. I don't see any problem with onEnter for example. It works without any problems in my tests. You don't included any description or the demo, which reproduces the problem.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • 1
    Opposite bindkeys: up arrow and down arrow not work. – David O. May 12 '15 at 14:41
  • @DavidO.: Thank you for the bug report! I posted [the bug fix](https://github.com/free-jqgrid/jqGrid/commit/a86791e97a3cff963760cfa4623d3fdc3df07059) to GitHub. It was typing errors or cut&pasted errors. – Oleg May 12 '15 at 14:55
  • @Oleg . I tried code from github but problem persists in my case. I posted it in http://stackoverflow.com/questions/30199868/how-to-remove-horizontal-toolbar-from-free-jqgrid-if-autowidthtrue-and-big-tool – Andrus May 12 '15 at 19:59
  • @Andrus: The problem described in the question was: the existence of **horizontal bar** in the grid after . [The demo](http://jsfiddle.net/9ezy09ep/11/) used `cmTemplate: { autoResizable: true }, autoresizeOnLoad: true` so the width of column should be set based on the column width and so no horizontal scrollbar should exist. Your problem seems be another one. I will read your question and answer on it later. – Oleg May 13 '15 at 04:58
  • Oleg, please check again [1]: http://jsfiddle.net/9ezy09ep/13/ When i use ** $("#jqGrid").setGridWidth(500, true); **, scroll horizontal is positioned incorrectly. – David O. May 13 '15 at 15:23
  • @DavidO.: I'm not sure what is the goal of the code. You should understand the the line `$("#jqGrid").setGridWidth(500, true); ` will be executed **before** the data will be loaded from the server. If you would need to set the width inside of `loadComplete`: http://jsfiddle.net/OlegKi/9ezy09ep/15/. The problem is only that the code will **always reset the width to 500**. I don't understand your goal. Why you not just add `width: 500` as the option of jqGrid if you need to have fixed width? Alternatively you can use `autoresizeOnLoad: true` to have the flexible width based on the grid content. – Oleg May 13 '15 at 16:30
  • I have a UI dialog and a button that I click to open this dialog ui. When it is displayed , horizontal bar of grid it is displayed as shown in the example. Width of UI dialog is variable and i try fit with dialog. I do not know what does not work width option of jqGrid? It would not be better, as before and after loading the grid you can set the width? – David O. May 13 '15 at 17:52
  • @DavidO.: I still not sure that I correctly understand what you need, but why you not use something like http://jsfiddle.net/OlegKi/9ezy09ep/16/ which uses `autoresizeOnLoad: true` in jqGrid and `width: "auto", height: "auto"` in the dialog? – Oleg May 13 '15 at 17:53
  • The problem with `width` option of empty grid is easy. One can either display an empty place on the right size of the grid or don't do this. It's important to understand that the columns will be displayed **before the data are loaded**. You can see first the grid with "Loading..." div *and then* the data will be filled. Only free jqGrid have `setColWidth` method which changes the width of the column **after the grid is created**. So one can't fix the problem by having fixed `width` option because it means the width of the whole grid (with optional scrollbar inside) not the internal table width – Oleg May 13 '15 at 18:02
  • In old version 4.7.0 i use at width of UI dialog : $(window).width() and after load grid i fit width of jqgrid $("#jqGrid").setGridWidth($(window).width() , true); but now with free 4.8.0 , I do not know to be ok. – David O. May 13 '15 at 18:50
  • @DavidO.: **When** you call `$("#jqGrid").setGridWidth($(window).width() , true);`? Before loading of grid content via Ajax from the server of after it? Could you provide jsfiddle demo where jqGrid 4.7.0 work like you expect and free jqGrid works incorrectly? – Oleg May 13 '15 at 19:08
  • I call $("#jqGrid").setGridWidth($(window).width() , true) after load of grid content. Last line from $(document).ready is $("#jqGrid").setGridWidth($(window).width() , true) . – David O. May 13 '15 at 19:39
  • Jqgrid 4.7.0 http://jsfiddle.net/70u3m2r3/1/ and free-jqgrid 4.8.0 http://jsfiddle.net/9ezy09ep/13/ – David O. May 13 '15 at 19:48
  • @DavidO.: First of all you have to use ui.jqgrid.css and grid.locale-en.js from jqGrid 4.7.0: http://jsfiddle.net/OlegKi/70u3m2r3/2/. The problem in the code is another. It **always** calculate the width including place for the scrollbar which could not exist. If one change `rowNum` to 5 then one will see the following: http://jsfiddle.net/OlegKi/70u3m2r3/3/. It's not solution of the problem. Moreover you wrote before about `$("#jqGrid").setGridWidth($(window).width() , true)`, but the code don't contains the line. Why? – Oleg May 13 '15 at 20:01
  • When number of rows is large, scroll horizontal is positioned incorrectly in free 4.8.0. $("#jqGrid").setGridWidth(500, true), is last line in http://jsfiddle.net/9ezy09ep/13/ - jqgrid 4.8.0 but and in http://jsfiddle.net/OlegKi/70u3m2r3/3/ jqgrid 4.7.0. would be correct version 4.7.0 – David O. May 13 '15 at 20:14
  • @DavidO.: I explained you that jqGrid 4.7.0 reserve **always place for the scrollbar even if it don't exist**. It sows the demo http://jsfiddle.net/OlegKi/70u3m2r3/3/. I wrote you before that free jqGrid correctly (in my opinion) calculate the width *at the moment of executing of `setGridWidth`. So you can place it in `loadComplete` like in http://jsfiddle.net/OlegKi/9ezy09ep/15/, which I post you previously. In the case you will have width of column calculated based on the already loaded data and so based on the existence of scroll bar. Just choose to display 5 rows (in pager) and you see it. – Oleg May 13 '15 at 20:24
  • @Oleg: Please check this demo http://jsfiddle.net/9ezy09ep/17/. When i click on open button, $(this).setGridWidth(520, true); from loadComplete function not work. I think it is a problem ui dialog, because only in this context horizontal bar is show incorect. – David O. May 14 '15 at 16:05
  • @DavidO.: The last demo create the hidden grid and the shows it on opening. It's wrong because **one can measure the width of only visible elements**. So you should either create the grid inside of `open` callback like http://jsfiddle.net/OlegKi/9ezy09ep/18/ do or, which is better, to call `$("#jqGrid").jqGrid("setGridWidth", 520, true);` inside of `open` callback of the http://jsfiddle.net/OlegKi/9ezy09ep/21/ dialog or to do both to be sure. – Oleg May 14 '15 at 16:53
  • @DavidO.: By the way I modify you demos every time to remove syntax error in the usage of **two** `height` property in one object, I remove unneeded options, pager div and so on (see http://jsfiddle.net/OlegKi/9ezy09ep/21/), but the next your demo have all old small problems back. I recommend you to compare your original demo with http://jsfiddle.net/OlegKi/9ezy09ep/21/. – Oleg May 14 '15 at 16:56
  • @Oleg: I understand solution for UI dialog, but I have the same problem with UI tabs. ie for second tabs . What recommendation would be for it? – David O. May 15 '15 at 14:48
  • @DavidO.: Absolutely the same recommendation: call `setGridWidth` or `autoResizeAllColumns` method **after the grid will be visible** (inside of `activate` callback of jQuery UI Tab or inside of `tabsactivate` event of jQuery UI Tab) or just create and load the data on the activation. All the discussion are far from the question which you asked. One should aks short and clear question and accept it after getting the solution. The long discussion could help you, but it's not help other visitors of the page and the discussion can be bad indexed by searching engine. – Oleg May 15 '15 at 15:20