Setting a value from a function

2 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 08 May 2012 Link to this post

    Here's the scenario...I have a button on my model....essentially a toggle.  However the model STATE should only change if the $.ajax call returns this is what I tried

    viewModel = kendo.observable({
            releaseMe: function (item) {
    function release(item) {
        var releaseState =;
        var campus =;
        var block = viewModel.BlockID;
        var url = "/api/cps/clerkship/blocks/" + block +  "/" + campus + "/";
        if (!releaseState)
            url += "release";
            url += "unrelease";
            url: url,
            type: "PUT",
            data: {
                id: block,
                campus: campus
            success: function (e) {
                if (!releaseState)
                    item.set("Released", true); //WHAT SHOULD THIS BE
                    item.set("Released", false); //WHAT SHOULD THIS BE

    Any idea?  Should it literally just be a simple = true;
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 10 May 2012 Link to this post


     To set a field you should use the set method. If you want to set then use this
    item.set("data.Released", true). This is mentioned in the ObservableObject help topic.

    Atanas Korchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top