0

I am testing example at this url : http://trirand.com/blog/jqgrid/jqgrid.html . Right now Detail Grid is loading with default id at the page load.

Requested functionality:

I want Detail button in each row when clicked should load the Detail Grid. Anyone please tell me how. I am also struggling with that.

Pirzada
  • 4,685
  • 18
  • 60
  • 113

1 Answers1

3

You can use custom formatter or instert the <botton type='button' ....> (or <input type='button' ...>) with respect of 'setRowData' inside of loadComplete or gridComplete event handler. You can find an example if you look at jqGrid demo and choose "Row Editing" / "Custom Edit". The binding of onClick event you can do either as in "Row Editing" / "Custom Edit" example or in unobtrusive way (see an example from here not exactly for the same problem, but I hope you will understand what I mean) using jQuery.click or jQuery.bind. By the way instead of the button you can consider to use link (<a> or showLink).

Inside of "click" handle you can force loading of the detail grid exactly like you do this typically inside of onSelectRow.

UPDATED: Look here to see how one can place static texts as links in the jqGrid: alt text

It could be needed to fill empty string '' in the "Details" column in the JSON respond from the server. In some cases depends from the data format and the jsonReader used it could be not required.

In case of master/detail scenario you can display (set url or postData and trigger gridReload) detail grid on the place where "clicked the row ..." texts are displayed in the demo example.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Onething. How can I make link to display static text like Detail in below code. I don't want it bindable just want to display text like Detail. colModel: [ { name: 'Subcategory', index: 'companyState' , width: 100, sortable: false, align: 'center' , formatter: 'showlink', formatoptions: { baseLinkUrl: 'someurl.php', addParam: '&action=edit' } } ], – Pirzada Dec 24 '10 at 12:47
  • 1
    @pirzada: Do you read information from the links which I posted you? Is http://www.ok-soft-gmbh.com/jqGrid/UnobtrusiveLinks.htm not display what you want? If you change the line `location.href="http://en.wikipedia.org/wiki/"+text` to displaying detail grid you will have what you need. – Oleg Dec 24 '10 at 13:10
  • Thanks Oleg. I always read whatever posted before I post my question. Right now when links are generated in grid are bindable to subcategory in your above demo link and showing subcategory names as links to click. All I want is to display "Detail" static text as links to click on like Detail . Hope you get my point. – Pirzada Dec 24 '10 at 17:21
  • 1
    Please read above comment for answer. Onething that I want to ask is. Is it possible to have Numeric paging in JQGrid like 1 2 3 .. ? – Pirzada Dec 24 '10 at 17:24
  • @pirzada: Paging in the form like "1 2 3 ..." is not possible in jqGrid. Instead of that one can **type any page number and press "Enter"** or use previous, next, first and last page. The total number of pages are also shown. It seems me enough for page navigation. If you want you can add to any field the "title" attribute and the tooltip will be displayed. Fore example `$("input.ui-pg-input","#pager").attr("title","Type new page number here and press 'Enter'");` or `$("td.ui-pg-button#first","#pager").attr("title","Click here to go to the first page");` – Oleg Dec 25 '10 at 11:26
  • @pirzada: I included a small demo which demonstrate how one can place static 'Detail' text in all links and display some demo text below the grid. In case of master/detail scenario you can display (set url or postData and trigger gridReload) detail grid on the place. – Oleg Dec 25 '10 at 12:10