This is a migrated thread and some comments may be shown as answers.

Columns from webapi but editor property not working

1 Answer 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
NS
Top achievements
Rank 1
NS asked on 22 May 2017, 08:32 AM

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"}]

 

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 23 May 2017, 03:25 PM
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.
Tags
Grid
Asked by
NS
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or