Updating an array element

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

    Posted 01 Dec 2014 Link to this post

    Whats the best way to update an array element?

    My array list is massive (large objects) so if I clone it, change THAT array, then set the clone back, there's some noticable lag in the app.

    How would I just update a array element, or like a single property OF that array element.
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 03 Dec 2014 Link to this post

    Hi Steve,

    Please check this example as it demonstrates how to update single property of an array element: http://dojo.telerik.com/@valchev/OtIjI

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 03 Dec 2014 in reply to Alexander Valchev Link to this post

    Okay let me ask you this...

    Given this in my template
                    <span data-bind="attr: { class: getStatusClass }"><span data-bind="text: Status"></span></span>
                    <span class="logcount" title="Encounters Logged"><span data-bind="text: LogCount"></span>

    When I update "Status" on the item as you defined, the text updates okay, but the getStatusClass function isn't called.  I used to have it as <span class="status #: Status #" but that wasn't updating through the model change...so I moved it to a function.

    What should I be doing here?
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 05 Dec 2014 Link to this post

    Hello Steve,

    Could you please update the Dojo example that I provided below so it illustrates your exact case?
    In this way I will be able to examine your exact implementation and assist you further.

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Dec 2014 in reply to Alexander Valchev Link to this post

    Sure here: http://jsbin.com/famixo/2/

    Why aren't the completed items turning green?
  7. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 05 Dec 2014 Link to this post

    Hi Steve,

    Issue occurs because dependent methods must use the get method to get field values. For more information please check this help article:
    Here is a link to the updated example: http://jsbin.com/qiqexuroxa/1/edit

    Please also note that the template should have a single root item.

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Dec 2014 in reply to Alexander Valchev Link to this post

    Ah geez yeah, thanks

    Hey, is there a way to do it right from the template so I don't have to have a function to return a single bound value?
  9. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 09 Dec 2014 Link to this post

    Hi Steve,

    The getStatusClass method basically gets the "Status" value. You may bind the class directly to the "Status" field.

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready