filtering datasource and default value

2 posts, 0 answers
  1. Phil
    Phil avatar
    2 posts
    Member since:
    Feb 2012

    Posted 04 Oct 2012 Link to this post

    hello,
    i'am a newbie with kendoui and i like it so i have a problem with the defaultvalue when i add a new record.
    i have two listview with new record button,  the second depends on the first.
    When i select one item on the first listview , i filter  the second listview  like :

    dataSourceEnseigne.filter({ field: "idSociete", operator: "eq", value: selected[0]});

    this work fine but when click on the add button i have some problem:
    $("#addEnseigne").click(function(e) { listViewEnseigne.add(); e.preventDefault(); });

    I don't no how to reset the value defaultvalue dynamically

    the symptom is :
    if no record displayed ==> add operation fail
    if one or more record displayed ==> add operation display edit template with value of the first item displayed (like edit function).

    after more tests i see that  defaultvalue of field must be set to the filter value for this work fine.

    What's the method ?
    i try :
    var data = dataSource1.view(),
          selected = $.map(this.select(), function(item) { return data[$(item).index()].idSociete; }); combosocietes.value(selected[0]);
    dataSourceEnseigne.filter({ field: "idSociete", operator: "eq", value: selected[0]});                                                                          dataSourceEnseigne.options.schema.model.fields.idSociete.defaultValue=selected[0];(don't work)
     listViewEnseigne.dataSource.options.schema.model.fields.idSociete.defaultValue=selected[0]; (don't work)

    can anyone help me
    Thank's for your reply
    Phil

  2. Phil
    Phil avatar
    2 posts
    Member since:
    Feb 2012

    Posted 09 Oct 2012 Link to this post

    hello,
    i found this:

     "kendouimodel".fn.defaults."fieldname"= "new defaultvalue"

    it's work

    regards
    Phil
Back to Top