You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi
I think I found a bug on the framework, I just wanted a confirmation
I'm using dgrid with a tree architecture
and while adding elements to subnodes, I got some weird sorting after inserting a certain number of elements.
Here is the way I did my insertions:
updateCharges:function(path){
var pathArr = path.split(":");
page.grid.set('collection',null);
//Bien.get(pathArr[0]) returns the array with the elements contained by the node whose name is the value contained in pathArr[0]
//_id is the identifier of my collection
Bien.get(pathArr[0]).forEach(function(field,index){
var isRemoved=Bien.getRemoved(pathArr[0]+':'+index);
field._id=pathArr[0]+"_"+index;
field.id=index;
if(isRemoved===true){
page.collec.remove(field._id);
}
else{
page.collec.put(lang.mixin({parent:pathArr[0],hasChildren:false,path:pathArr[0]+':'+index,editable:true},field));
}
});
page.grid.set('collection',page.collec);
}
with the createHierarchicalStore given in dgrid/test/data (not modified)
after a few nights of struggle I eventually found out approximately the way it worked.
It appears that there are 3 "queryMethods" , or 3 entries in the "querylog" variable, i must admit this remains mostly unclear for me
anyway, i understood that 1 is filtering by parent, the second sorting by id
and the 3rd is mysteriously an empty array
in theory it shouldnt have been a problem, since in the _createSortQuerier of "SimpleQuery", it is specified to return '0' on the compare function of "data.sort" in case of empty array,
but for some reason, data changes after the call to sort
even tough the compare function is returning 0.
if added this line in the beginning of _createSortQuerier:
_createSortQuerier: function (sorted) {
var queryAccessors = this.queryAccessors;
return function (data) {
//debut solution brutale
if(sorted.length===0 && typeof sorted != 'function'){
return data;
}
[...]
and the problem disappears.
But I cannot find out why is this 3rd entry in the qerylog array present, and last but not least, I cannot find out in dgrid nor in dstore code where this is added
so if somebody can light my candle it'd be great, because the solution I found smells like a workaround.
Cheers
Guillaume
The text was updated successfully, but these errors were encountered:
hi
I think I found a bug on the framework, I just wanted a confirmation
I'm using dgrid with a tree architecture
and while adding elements to subnodes, I got some weird sorting after inserting a certain number of elements.
Here is the way I did my insertions:
page.collec is created this way:
with the createHierarchicalStore given in dgrid/test/data (not modified)
after a few nights of struggle I eventually found out approximately the way it worked.
It appears that there are 3 "queryMethods" , or 3 entries in the "querylog" variable, i must admit this remains mostly unclear for me
anyway, i understood that 1 is filtering by parent, the second sorting by id
and the 3rd is mysteriously an empty array
in theory it shouldnt have been a problem, since in the _createSortQuerier of "SimpleQuery", it is specified to return '0' on the compare function of "data.sort" in case of empty array,
but for some reason, data changes after the call to sort
even tough the compare function is returning 0.
if added this line in the beginning of _createSortQuerier:
and the problem disappears.
But I cannot find out why is this 3rd entry in the qerylog array present, and last but not least, I cannot find out in dgrid nor in dstore code where this is added
so if somebody can light my candle it'd be great, because the solution I found smells like a workaround.
Cheers
Guillaume
The text was updated successfully, but these errors were encountered: