title: Kendo MVVM binding on null values binds as object
body: <p>there seems to be a rather peculiar design decision when it comes to the binding behaviour in Kendo.</p>
  
  <p>I'm trying to bind a nullable value to a drop down list. If the (remotely sourced) value is null, then Kendo will generate objects to bind to the value instead, for example, using the data-value-field/value of the dropdown.
  This makes saving the modified viewmodel extremely unreliable, since now entire objects would get transmitted instead of simple data types.</p>
  
  <p>Example:
  <code>Schedule.WeekNumber</code> is <code>null</code>. After selecting a value from a DropDown like</p>
  
  <pre><code>&lt;select data-role="dropdownlist" name="scheduleWeekOfMonth"
      data-bind="value:WeekNumber"&gt;
    &lt;option value=""&gt;Every week&lt;/option&gt;
    &lt;option value="0"&gt;First week of month (1.-7.)&lt;/option&gt;
    &lt;option value="1"&gt;Second week of month (8.-14.)&lt;/option&gt;
    &lt;option value="2"&gt;Third week of month (15.-21.)&lt;/option&gt;
    &lt;option value="3"&gt;Last week of month (22.+)&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>The value (JSON) then is <code>Object {text: "First week of month (1.-7.)", value: "0"}</code> instead of <code>"0"</code></p>
  
  <p>Has anyone got a good solution for this? - besides replacing all null values of the viewmodel on load, eg:</p>
  
  <pre><code>function deNull(obj) {
    if(obj !== null &amp;&amp; typeof obj === "object") {
      $.each(obj, function(index, value) {
        if(value !== null &amp;&amp; typeof value === "object") {
          deNull(obj[index]); // we must go deeper (BRRRRRRRAAAAAWWWWRWRRRMRMRMMRMRMMMMM)
        }
        if(value === null) {
          obj[index] = "";  // workaround, this is the "null" equivalent of not being set         
          //console.log("De-nulled: " + index);
        }
      });
    }
  }
  </code></pre>