Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is that DataSource is initialized asynchronously, I mean, you start loading when the <code>combobox</code> is initialized but the operation does not finish until the data is received back from the server. Then, and only then, is when you should invoke that element. Is not even acceptable move the <code>add</code> statement to the end of the sample code since loading from a server might take milliseconds or seconds.</p> <p>If you want to add an element to what is being received from the server, you might use:</p> <pre><code>$(document).ready(function () { //Combobox Init (From Servlet) var comboBoxDataSource = new kendo.data.DataSource({ transport: { read: { url : "net/samso/action/common/ComboAction?flag=SRCHGT_IO_GB", // url to remote data source dataType: "json", type : 'GET' } }, schema : { model: { fields: { key : { type: "string" }, value: { type: "string" } } }, data: function(result) { //Manually add an item result.push({key: "062", value: "Total"}); return result } } }); //Initialize Combobox $("#cb_srchgt_io_gb").kendoComboBox({ dataSource : comboBoxDataSource, dataTextField : "value", dataValueField: "key" }) }); </code></pre> <p>You might do the same thing using <code>requestEnd</code> event and pushing the extra element to <code>e.response</code>:</p> <pre><code>requestEnd: function (e) { console.log("e", e); e.response.push({key: "062", value: "Total"}); } </code></pre> <p>Basically, any event that is fired after being received the data from the server is fine.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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