Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150906 | Jan 23,2020 10:03 PM UTC | Jan 29,2020 05:47 PM UTC | Vue | 4 |
![]() |
Tags: RichTextEditor |
If your data set is large or would like to pre filter your data you can load dynamically by setting the values
to a function.
{
//..other config options
// function retrieving an array of objects
values: function (text, cb) {
remoteSearch(text, users => cb(users));
},
lookup: 'name',
fillAttr: 'name'
}
You would then define a function, in this case remoteSearch
, that returns your data from the backend.
function remoteSearch(text, cb) {
var URL = 'YOUR DATA ENDPOINT';
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var data = JSON.parse(xhr.responseText);
cb(data);
} else if (xhr.status === 403) {
cb([]);
}
}
};
xhr.open("GET", URL + "?q=" + text, true);
xhr.send();
}
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.