Bind column to a computed prperty

4 posts, 0 answers
  1. Kenneth
    Kenneth avatar
    12 posts
    Member since:
    Jan 2013

    Posted 04 Mar 2013 Link to this post

    I have a grid with several computed columns.I set the computed properties when I change the properties in the grid edit mode . Do I need to use editor template to make a read only column (when I set editable:false it doesn't change according to the new value)? 

    And I have several computed properties in grid, Is there any other way to make it a generic calculation instead of using if/else for change property name like this,

       
     save: function(data) {
         
            if (data.values.Qty) {
                var test = data.model.set("Total", data.values.Qty * data.model.Amt);
            }
            else {
                var test = data.model.set("Total", data.model.Qty * data.values.Amt);
            }
        }

    Is there any event like saved (to get the data.model with changed property has been set)? 

    And the other issue is when I have several computed fields set like this the save method is called for each calculated field set. 

    Here is my example,
    http://jsfiddle.net/H6tgv/74/
  2. Holger
    Holger avatar
    77 posts
    Member since:
    Nov 2012

    Posted 05 Mar 2013 Link to this post

    Do I need to use editor template to make a read only column (when I set editable:false it doesn't change according to the new value)? 

    No, you can just set the editable property of the field in datasource's schema configuration to false.
  3. Kendo UI is VS 2017 Ready
  4. Kenneth
    Kenneth avatar
    12 posts
    Member since:
    Jan 2013

    Posted 05 Mar 2013 Link to this post

    Yes, but then it doesn't change to the modified value if I set that after grid is loaded.
  5. Holger
    Holger avatar
    77 posts
    Member since:
    Nov 2012

    Posted 05 Mar 2013 Link to this post

    You are right. According to this thread using a editor template (function) seems to be the only solution.
Back to Top
Kendo UI is VS 2017 Ready