Hi, I have a CustomEditView for my restful table, that is a single select field. But the content is dynamically getting use ajax. See my code:
var editFieldView = AJS.RestfulTable.CustomEditView.extend({
render: function (self) {
var select = $("<select name='field' class='select'></select>");
$.getJSON(url) // Get list of options use ajax here doesn't work
.done(function (data) {
$.each(data, function () { // This each run after return statement
var option = "<option value='" + this.fieldId + "'>" + this.fieldName + "</option>";
select.append(option);
});
});
select.val(self.value);
return select;
}
});
It might be problem with async because its return element before data received.
So how can I do my job in this case? Thanks
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.