0

I have a analytics module which is based on bootstrap 3, angular, grid by JQgrid and graphs by C3. The problem is when I go to the grid and select a row in JQgrid it looses focus and scrolls back to the top where new graph is generated,

focus when grid is clicked:

enter image description here

and you have to scroll down everytime the graph is changed onSelect of rows.

After selection grid looses focus and starts to focus on the chart:

enter image description here

And it keeps happening when you select a row and it becomes annoying to go back down everytime to select a row. Is there a way to not loose focus when chart is generated. I can't create a JSFiddle as the page is dynamic and have lots of nested code and javascript files attached to it.

The Gif of the issue:- enter image description here

Jqgrid Config:- jqgrid config pastebin

c3 Config:- c3 chart pastebin

Suleman Mirza
  • 905
  • 1
  • 12
  • 22

1 Answers1

1

I strictly recommend you to use Developer Tools of IE/Chrome/Firefox (press F12 to start) and examine id attributes of the rows (rowids) of grids and subtrids. I suppose that you have id duplicates. You should always use idPrefix option of jqGrid in every subgrid scenario or even if you have more as one grid on the same page. Typical value of idPrefix option of subgrid looks like idPrefix: "s_" + rowid + "_".

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Hi Oleg thanks for your reply, I already have that implementation of rowid. my rowID is something like `summaryGrid_16063ed801c36632ccabad6552000f82_t` – Suleman Mirza Mar 31 '15 at 19:08
  • @SulemanMirza: Which version of jqGid you use? To tell the trust I didn't full understand your description of the problem which you have. You can at least use program like [LICEcap](http://www.cockos.com/licecap/) to create animated GIF which **shows** the problem. Without you post the code one can still only guess and you will have to debug the code yourself. – Oleg Mar 31 '15 at 19:42
  • I have put a GIF and also jqgrid config in pastebin. So issue is when ever you select a subgrid Row the page looses focus from the grid and jumps up to the chart generated. So a user have to go back down again to select more subgrid Rows. – Suleman Mirza Mar 31 '15 at 20:04
  • @SulemanMirza: **Which version of jqGid you use?** Which options of jqGrid you use: virtual scrolling (`scroll: 1`), use `beforeSelectRow`, `onSelectRow` or `onCellSelect` callback, .... Do you use `scrollrows: true` option in subgrid? – Oleg Mar 31 '15 at 21:25
  • I am using Jqgrid 4.6.0 and didn't used scrollrows option. because the jqgrid is fixed in height, and there is no vertical scroll in it. I think the problem is more bootstrap or C3 related. – Suleman Mirza Apr 01 '15 at 16:10