Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to load Values into the edit-form of jqGrid when user select from select box
    primarykey
    data
    text
    <p><br> In the edit Form is a select dropdown. When the user select an item, i want to load some values and fill them into the form.</p> <p>My code so far:</p> <pre><code>var grid = $("#list").jqGrid({ parameters..., colNames:[...], colModel :[ ... ] }); $("#list").jqGrid( 'navGrid', '#pager', { view:true, edit:true, del:true, search:false, }, /* EDIT */ { closeAfterEdit: true, afterSubmit: processAddEdit, onInitializeForm: setFormEvents, ... } ... ); function setFormEvents(formid) { /* It sometim works when using timeout.. * It seems to be a timing issue. * But i have no idea why and how to solve */ setTimeout ( function(){ $('select#data_id', formid).unbind(); $('select#data_id', formid).change(function() { $.getJSON("/URL?dataid=" + $('select#data_id option:selected').val(), function(data){ $.each(data, function(i,item){ if (item.field == "anrede") { $("#anrede").val(item.value); } else if (item.field == "titel") { $("#titel").val(item.value); } else if (item.field == "vorname") { $("#vorname").val(item.value); } else if (item.field == "nachname") { $("#nachname").val(item.value); } else if (item.field == "firma") { $("#firma").val(item.value); } else if (item.field == "strasse") { $("#strasse").val(item.value); } else if (item.field == "hausnummer") { $("#hausnummer").val(item.value); } else if (item.field == "plz") { $("#plz").val(item.value); } else if (item.field == "ort") { $("#ort").val(item.value); } else if (item.field == "land") { $("#land").val(item.value); } }); }); }); }, 1000 ); } </code></pre>
    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