I am using:
- Kendo UI Complete 2013.1.319
- Windows 7 64-bit
- Google Chrome 26.0.1410.64 m
- The jQuery bundled with Kendo
I have the following HTML:
And the following JavaScript:
This all works as expected - I can update the data in the grid. I am however storing the data in couchdb and need to update the data source with the new revision number after create and update events are complete.
I think that I need to replace the object I'm using with create and update with a function to allow me to do this. I have attempted to do this with just a simple function as shown below:
This however results in an error on the JavaScript console when I modify a record in the grid:
Where is the mistake I'm making? I also tried copy-and-pasting the exact declaration from the documentation for transport.update with the same results.
- Kendo UI Complete 2013.1.319
- Windows 7 64-bit
- Google Chrome 26.0.1410.64 m
- The jQuery bundled with Kendo
I have the following HTML:
<
div
id
=
"app"
></
div
>
<
script
type
=
"text/x-kendo-template"
id
=
"users"
>
<
div
data-role
=
"grid"
data-filterable
=
"true"
data-editable
=
"true"
data-sortable
=
"true"
data-bind
=
"source: usersSource"
data-columns
=
"[{ field:'username', title:'Username' }, { field:'fullname', title:'Full Name' }, { command:'destroy' }]"
></
div
>
</
script
>
var
usersModel = kendo.observable({
// the users data
usersSource:
new
kendo.data.DataSource({
autoSync:
true
,
schema:{ model:{ id:
"_id"
} },
transport:{
create:{ url:
"/user"
, dataType:
"json"
, type:
"POST"
},
destroy:{
url:
function
(user) {
console.log(user)
return
"/user/"
+ user._id +
"/"
+ user._rev
},
type:
"DELETE"
,
dataType:
"json"
},
read:{ url:
"/users"
, dataType:
"json"
},
update:{ url:
"/user"
, dataType:
"json"
, type:
"POST"
}
}
})
});
var
usersView =
new
kendo.View(
"users"
, { model:usersModel});
var
router =
new
kendo.Router({
init:
function
() {
usersView.render(
"#app"
);
}
});
$(
function
() {
router.start();
});
I think that I need to replace the object I'm using with create and update with a function to allow me to do this. I have attempted to do this with just a simple function as shown below:
/* trimmed */
update:
function
(options){console.log(options);}
/* trimmed */
Uncaught SyntaxError: Unexpected number kendo.web.min.js:9
st.setter kendo.web.min.js:9
tt.extend._set kendo.web.min.js:11
zt.extend.accept kendo.web.min.js:11
tt.extend._accept kendo.web.min.js:11
(anonymous function) kendo.web.min.js:11
(anonymous function) jquery.min.js:3
c jquery.min.js:3
p.fireWith jquery.min.js:3
i.(anonymous function) jquery.min.js:3
a.(anonymous function).call.q.success kendo.web.min.js:11
c jquery.min.js:3
p.fireWith jquery.min.js:3
k jquery.min.js:5
r jquery.min.js:5