This is a migrated thread and some comments may be shown as answers.

filtering datasource and default value

1 Answer 173 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 04 Oct 2012, 03:21 PM
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

1 Answer, 1 is accepted

Sort by
0
Phil
Top achievements
Rank 1
answered on 09 Oct 2012, 07:15 AM
hello,
i found this:

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

it's work

regards
Phil
Tags
Data Source
Asked by
Phil
Top achievements
Rank 1
Answers by
Phil
Top achievements
Rank 1
Share this question
or