Hi,
Could anyone please help with this issue? I’m using Webix Jet. I’m trying to build a form based on JSON data retrieved from Ajax call. The idea is to only return the $ui layout after receiving the data and building the form.
I’m getting an error “core.js:185 Uncaught RangeError: Maximum call stack size exceeded”
My code is as follows:
define([], function() {
return webix.ajax("core.php/permissions/get").then(function(data) {
//initialize variables
var layout, permission, permissions;
//get JSON data
permissions = data.json(); //
/*[{"id":"66","name":"Accounts - Live","description":"Create a live client account","key":"accounts_live"}]*/
//form elements
var elements = [
{view: "text", name: "name", label: "Name"},
{view: "label", label: "Description", height:30},
{view: "textarea", name: "description", height: 70},
{view: "label", label: "Role permissions", height:30},
//{view:"checkbox", label:"First check", value: 1, name: "chk_a"},
//{view:"checkbox", label:"Second check", value: 1, name: "chk_b"},
//{}
];
//console.log(permissions);
//add checkboxes to the form elements
for (i = 0; i < permissions.length; i++) {
permission = permissions[i];
console.log(permission);
elements.push({
view: "checkbox",
label: permission.name,
value: 1,
name: "check_" + permission.id
});
}
//add space at the bottom of the form
elements.push({});
//build the form and add the dynamically built elements
layout = {
view: "form",
id: "role:edit",
elementsConfig: {
labelWidth: 130
},
scroll: true,
elements: elements,
rules:{
"name": webix.rules.isNotEmpty,
"description": webix.rules.isNotEmpty
}
};
return {
$ui: layout
};
});
});