JqGrid parameter options tableToGrid "options"

The basics

Hi everyone, I see the tableToGrid method (author Peter Romianowski), defined as tableToGrid(selector, options) in the jqGrid wiki, but cannot find anywhere that has options documentation

Does anyone know about these or where to find them? EDIT: Thanks, Oleg, decided!

More details

What I'm really trying to do is enclose the resulting jqGrid in a form that will send the checkbox values ​​that are in the table column. My problem is that the tableToGrid method seems to remove the name property from the checkbox elements and therefore is not sent with the form message.

+3
source share
3 answers

RESOLVED

The jqGrid method tableToGrid will find the value of the flags in the source table and automatically implement the multiSelect: true parameter in the resulting jqGrid, showing the internal flags. For a list of selected row identifiers, simply call

 $('#grid').getGridParam('selarrrow') 
+1
source

As you can read http://www.trirand.com/jqgridwiki/doku.php?id=wiki:table_to_jqgrid the parameter parameters of the tableToGrid method are nothing more than the jqGrid parameters you create (see http: // www .trirand.com / jqgridwiki / doku.php? id = wiki: options ).

If I give up your main problem, you will receive some data received from the server, as an answer to the submit form. And you want to put this data in a grid. You can use a more direct path for this with datatype: 'local' jqGrid. Here is an example:

 var grid = jQuery('#list').jqGrid({ caption: 'Testclusters', height: 'auto', gridview: true, rownumbers: true, sortable: true, datatype: 'local', viewrecords: true, pager: '#pager', pgbuttons: false, pginput: false, rownumbers: true, colNames: ['Name', 'Testtiefe', 'Std', 'FachlicheTests', 'RowVersion'], colModel: [ { name: 'Name', index: 'Name', width: 120 }, { name: 'TesttiefeName', width: 180 }, { name: 'Std', width: 21, formatter: 'checkbox', align: 'center' }, { name: 'IsFachlicheTests', width: 21, formatter: 'checkbox', align: 'center' }, { name: 'RowVersion', width: 50, hidden: true } ] }).navGrid('#pager', { edit: false, add: false, del: false, refresh: true, view: false, search: false }) .navButtonAdd('#pager', { caption: "", buttonicon: "ui-icon-calculator", title: "choose columns", onClickButton: function() { jQuery('#list').jqGrid('columnChooser'); } }); grid.jqGrid('gridResize'); var myData = [ { Name: "VIA XP", TesttiefeName: "Alle SW-Produkte", Std:true, IsFachlicheTests:false, RowVersion: "20FC31" }, { Name: "KUBUS", TesttiefeName: "Alle SW-Produkte", Std:false, IsFachlicheTests:true, RowVersion: "20FC32" } ]; for (var i = 0; i <= myData.length; i++) { grid.addRowData(i + 1, myData[i]); } 

First you create an empty jqGrid, and then fill it with the addRowData method.

Also, if you have many checkboxes inside jqGrid, you might be interested in looking at my example from the Vertical text inside the table headers using the JavaScript-based SVG library and see the results http://www.ok-soft-gmbh.com/VerticalHeaders /TestFixedO1.htm .

+7
source

Change column width for any number of columns

In this case, after assembling the jqgrid assembly, you can simply go to the table to be created and manually change all column heading column widths and corresponding data without correcting the necessary code.

  var tabColWidths ='70px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px'; function reDefineColWidth(){ var widthsArr = tabColWidths.split('|'); for(var j=0; j < widthsArr.length ; j++ ){ $('.ui-jqgrid-labels > th:eq('+j+')').css('width',widthsArr[j]); $('#grid tr').find('td:eq('+j+')').each(function(){$(this).css('width',widthsArr[j]);}) } } 
0
source

Source: https://habr.com/ru/post/1308499/


All Articles