Note that there are some explanatory texts on larger screens.

plurals
  1. POPopulate dropdown in Jtable with Jquery
    text
    copied!<p>I have a jsp page <strong>material.jsp</strong> with following code snippet : </p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $('#MaterialTableContainer').jtable({ title : 'Table of Materials', actions : { listAction : 'CRUDControllerForMaterial?action=list', createAction : 'CRUDControllerForMaterial?action=create', updateAction : 'CRUDControllerForMaterial?action=update', deleteAction : 'CRUDControllerForMaterial?action=delete' }, fields : { id : { title : 'ID', key : true, list : true, create : true }, materialName : { title : 'MaterialName', width : '30%', edit : true }, description : { title : 'Description', width : '30%', edit : true }, lastModifiedComments : { title : 'LastModifiedComments', width : '20%', edit : true }, materialClassID : { title : 'MaterialClassID', width : '50%', edit : true, options : ["1","2","3","4","5"] }, isMaster : { title : 'IsMaster', width : '50%', edit : true } }}); $('#MaterialTableContainer').jtable('load'); }); &lt;/script&gt; </code></pre> <p>Now, in this, I want <strong>materialClassID</strong> to be a dropdown. So, in <strong>options</strong>, I have hard-coded values as <strong>["1","2","3","4","5"]</strong>.</p> <p>But, these <strong>values are to be dynamic</strong>, i.e., these values should be fetched from the server (servlet) at runtime. So, how can I make a call to a function at this point, and retrieve the list/result-set.</p> <p><strong>We are using servlet-jsp, so I would need to write the code in Java.</strong></p> <p>Any suggestion would be of great help.</p> <p>Thanks in advance.</p>
 

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