5

How can I set the width of the default view from the grid. The default is 300px but I can't find any documentation on how to change it. I could find info on changing the width of the default edit but not the view.

animuson
  • 53,861
  • 28
  • 137
  • 147
cfrunningman
  • 77
  • 1
  • 5

1 Answers1

6

The place of the documentation is here. You can specify the width in the parameters of viewGridRow method. You call the method directly like here

onSelectRow: function (id) {
    $(this).jqGrid('viewGridRow', id, {width: 500});
}

or you can use "View" icon in the navigator bar:

$("#list").jqGrid('navGrid', '#pager',
    {add: false, edit: false, del: false, search: false, view: true},
    {/*edit options*/}, {/*add options*/}, {/*del options*/}, {/*search options*/},
    {width: 500});
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Oleg, I'm able to set the width using your first example, but not the second, using the exact same format of your example. This is jqGrid 4.3.1. I ended up setting a css rule instead. – earachefl Feb 29 '12 at 16:30
  • @earachefl: Thanks, you are right. I forgot to include Search parameters (see [the documentation](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:navigator#definition)). I fixed the code. I find better to change the defaults `$.expand($.jgrid.search, {width: 500});` and then skip all the last parameters of `navGrid`. – Oleg Feb 29 '12 at 16:47
  • @Oleg I cant change the width of view icon. How to do, I am using jqgrid4.5.4. please help me how to set width and label size of the viewGridrow – Kumar Shanmugam Mar 18 '14 at 13:13
  • 1
    @KumarShanmugam: There are many ways to implement the requirements. See [the answer](http://stackoverflow.com/a/20165553/315935), [this one](http://stackoverflow.com/a/13865495/315935), [this one](http://stackoverflow.com/a/8854864/315935) and many other. – Oleg Mar 18 '14 at 16:16
  • Thank you @Oleg: sorry for the mistake of my comment... My query is the width could not be change in view form. How to handle the size of the form and how to make the space between label and value in the view form. – Kumar Shanmugam Mar 19 '14 at 05:06
  • @KumarShanmugam: Sorry, but I still don't understand your question. It's better if you post new question where you will describe and show (with screenshort) why the standard [View options](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing#properties1) can't solve your problem. – Oleg Mar 19 '14 at 06:03
  • @Oleg this is my post http://stackoverflow.com/q/22498523/2806972 please review this post thank you for your comments. – Kumar Shanmugam Mar 19 '14 at 06:59