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

Access model without using get(id)

1 Answer 394 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 16 Dec 2011, 08:53 PM
Is there a way to return a model without using get(id) ?

I am using this with the grid, and using a template for the column.  In the template, I use reference the Id to get the model. 

However, when creating a new row with the grid, there is no "Id" set so I need to find another way to access the model.

I can manually access the underlaying data with the "after" code.

But I want to to return the model so I can use .set() -- so that the 'modified' field is toggled -- so that the "save" toolbar button with run the update method.

Before:
$('#gridEmailAddress').data('kendoGrid').dataSource.get(#=Id#).set('StatusTypes[0].Flag',true)

After:
$('#gridEmailAddress').data('kendoGrid').dataItem(this.parentElement.parentElement).StatusTypes[0].Flag=true;


The after version sets the data, but it does not update the modified flag -- so when I click the "save" button the grid toolbar, it does not run the update method.



1 Answer, 1 is accepted

Sort by
0
Brandon
Top achievements
Rank 1
answered on 20 Dec 2011, 07:07 PM
Tags
Data Source
Asked by
Brandon
Top achievements
Rank 1
Answers by
Brandon
Top achievements
Rank 1
Share this question
or