Note that there are some explanatory texts on larger screens.

plurals
  1. POSingle column of select boxes with varied options using jqGrid
    primarykey
    data
    text
    <p>Have a grid that needs to have select boxes with different option values in the same column. For instance, in the test grid that was set up to trouble shoot this problem, the concept is to select one of the actors from a movie using a select box. Each row has the data for a different movie. Within each row the actors column has a different list of actors that need to be used to dynamically populate the select box for that row. The actor list is set up as CSV, comma separated values, in the database: I.E., Clint Eastwood, Tom Cruz, Vin Diesel. </p> <p>From the testing done, it looks like once the column model is set up, it is only executed once per grid load, meaning that you can only get one set of options for all select boxes in the column. Have successfully passed an html string with the desired values to the grid as returned data by setting up a loop block to generate the proper code in the php file that populates the grid, in this case myfirtgridajax.php, and while it displays as a functional select box with the proper values, it does not behave like a select box that was set in the column model up using</p> <pre><code>{... edittype:select, edit options:{value:{CE:'Clint Eastwood'... }}} </code></pre> <p>What is required is that a POST request be generated onChange or something with the same result, from the select box that will set another value in the database. That is, if Clint Eastwood is selected, then a POST request needs to be generated to pass that value to another php page for processing. </p> <p>My question is that while it looks like a hack setting event listeners on the select boxes that were created by passing an html string would work, is there a better way to do this? </p> <pre><code>&lt;script&gt; $(function () { $('#displayresultstable').jqGrid({ url:'../gridcalls/myfirstgridajax.php', datatype:'json', mtype: 'GET', colNames:['ID', 'movie', 'topic', 'rating','actors'], colModel :[ {name:'ID', index:'ID', width:50}, {name:'movie', index:'movie', width:200, editable:true}, {name:'topic', index:'topic', width:350, editable:true}, {name:'rating', index:'rating', width:50, editable:true }, {name:'actors', index:'actors', width:350, editable:true }, ], pager: '#pager', rowNum:10, height: 'auto', rowList:[5,10,15], sortname:'ID', sortorder: 'desc', viewrecords: true, gridview: true, cellEdit: true, cellurl:'../editfirstgridajax.php', caption: 'Movie Greats' }); $('#displayresultstable').jqGrid('navGrid','#pager', {view: true}); }); &lt;/script&gt; &lt;table id='displayresultstable'&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;div id='pager'&gt;&lt;/div&gt; </code></pre> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload