Answer the question
In order to leave comments, you need to log in
Why doesn't sorting and filtering work in jsgrid?
why doesn't sorting the received data on the client side work?
$("#jsGrid").jsGrid({
height: "90%",
width: "100%",
filtering: true,
sorting: true,
paging: true,
autoload: true,
editing: false
controller: {
loadData: function(filter) {
var urls = ['http://localhost:9200/company/test/_search/?size=1000'];
var result = $.Deferred();
var results = urls.map(function(url) {
var d = $.Deferred();
$.ajax({
url:urls,
type:"post",
dataType: "json",
}).done(function(data){
d.resolve(Object.entries(data.hits.hits).reduce((ini,[k,v])=>(ini[k]=v,ini),[]));
});
return d.promise();
});
Promise.all(results).then(function(values) {
result.resolve([].concat.apply([], values));
});
return result.promise();
}
},
fields: [
{ name: "name",type: "text", itemTemplate: function(value,item)
{
return item._source.name;
} , width: 50 },
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question