Columns from webapi but editor property not working

2 posts, 0 answers
  1. NS
    NS avatar
    189 posts
    Member since:
    Jan 2007

    Posted 22 May 2017 Link to this post

    Hello,

    I have a grid that supports a model.  But I want to generate different columns renderings depending on a value selected.
    eg.
    One time the value column needs to be a text box, numeric text box, color selector.

    I've managed to do so with everything in java script.  But now I want to move the column definition into my database and return a json array butI'm facing one problem and that is the editor property.

    The grid is generated if I leave all the editor properties empty.  But when I want to use one the grid isn't generated and I'm not getting any javascript errors.
    (The editors exists)

    This is what my service is returning:
    [{"field":"ValidFrom","title":"Valid from","width":"75px","format":"{0:dd/MM/yyyy}"},{"field":"ValidTo","title":"Valid to","width":"75px","format":"{0:dd/MM/yyyy}"},{"field":"Item","title":"Retailer loyalty score","width":"125px"},{"field":"Value","title":"Color","width":"75px","editor":colorEditor,"template":"<div style='background-color: #=Value#;'>&nbsp;</div>"},{"field":"RangeMin","title":"Min score","width":"75px"},{"field":"RangeMax","title":"Max score","width":"75px"},{"field":"Active","title":"Active","width":"50px","editor":customActiveEditor,"attributes":{"style":"text-align: center"},"template":"<div align=center><input style=\"display:none;\" id=\"Active_#=RuleID#\"   type=\"checkbox\" #= Active ? \"checked='checked'\" : '' # class=\"k-checkbox chbxItem\"  /><label class=\"k-checkbox-label\" for=\"Active_#=RuleID#\"</label></div>\r\n"}]

     

  2. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 23 May 2017 Link to this post

    Hello Nicolas,

    I would expect that this would be the result of a JavaScript error, but you say that you did not notice any such errors. Have you tried inspecting the Grid output to check if the Grid was created at all or an empty div is rendered? Also, you can check if the Grid databound event was fired? Additionally, see if defining a string template results in the same behavior to confirm if the problem is with the function reference.
    If the problem persists, please consider posting a Dojo, which demonstrates the issue, so I can debug it on my side.

    Regards,
    Tsvetina
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top