Hi,
I tried to set the ablfilter in view-factory .js like this:
onShow: function($scope, customData) {
this.scope = $scope;
$scope.model.gridOptions.dataSource.filter = function() {
return {filters:{field: "obez", operator: "begins", value: "b"}}
};
$scope.model.gridOptions.dataSource.sort = function() {
return {field: sortfieldplus, dir: "asc"};
};
There are no console messages and the result is an empty "ablFilter", while the "sort" is set as I wished.
JFPFill filter= {"ablFilter":"","orderBy":"obez","skip":0,"top":10}
What is wrong or what is to do?
Thanks in advance
Wolfgang
Hello Wolfgang,
What do you see if you display this.scope._$ds via the JavaScript Console?
The fact that you mentioned "beort" seems to say that that you are using a Blank view, however, the early mention that
this.scope._$ds.filter(filter) seems to indicate that you are using a view created from a pre-defined template.
Could you confirm what type of view it is?
I hope this helps,
Edsel
Hello Edsel,
You are right: it is not an blank view, so that's the reason why this.scope._$ds.filter(filter) works.
Thanks a lot
Wolfgang
Hi Wolfgang,
For the filter, can you try the code below (please replace orderDS with the name of your Data Source):
var filter = {
logic:'and',
filters: [
{ field: 'obez', operator: 'begins', value: 'b' }
]
};
this.scope._$ds['orderDS'].filter(filter);
If it works for you, please try sort by replacing the filter method with a sort method and adjust the variable being passed on the method ...
Regards,
Ricardo Perdigao
Hi Ricardo,
thanks for your ideas.
To make it work I changed the statement to
this.scope._$ds.filter(filter)
and it also worked for
this.scope._$ds.sort(sort)
For the filter there is only a problem with the operator "begins" which throws an erorr "invalid operator begins".
I tried "startswith" but it doesn't work too. "gt" or "ge" are working, but the result is of course different. The openedge Business Entities can handle the "begins" operator - would be nice if then KUIB would accept this too.
By the way: I have definde a JFP-extension for a property ppSID, so I tested:
this.scope._$ds.transport.jsdo.setProperty("ppSID","TestSID");
this doesn't throw an error, but it has no effect on the filter.
kind regards
Wolfgang
Hi Wofgang,
I've just tried "startswith" and it works fine for me. Here is the code I've tried (using the sports.customer table):
var customerFilter = {
field: 'Name',
operator: 'startswith',
value: 'a'
};
$scope._$ds['customerDS'].filter(customerFilter);
The reason I've included the model name on my _d$ call is because my view has more than one Data Source. But if you have only one Data Source on your view, the simplified syntax (without the DS name) will work.
The code above makes the following JFP request to my OE Backend:
filter:{"ablFilter":"Name BEGINS 'a'","skip":0,"top":5}
From what you are describing, it looks like your backend code might not be JFP enabled. Can you please post a copy of your Service Catalog or the backend code you've used? (.cls and .i)
Hi Ricardo,
thanks for your efforts.
Obviously I misspelled 'startswith' because now I retried and it works fine.
I tried to supply the name of the datasource
this.scope._$ds['beort'].filter(filter); where beort is the datasource used in the KUIB view definition
but this shows the console error: Cannot read property 'filter' of undefined
regards
Wolfgang
Hello Wolfgang,
What do you see if you display this.scope._$ds via the JavaScript Console?
The fact that you mentioned "beort" seems to say that that you are using a Blank view, however, the early mention that
this.scope._$ds.filter(filter) seems to indicate that you are using a view created from a pre-defined template.
Could you confirm what type of view it is?
I hope this helps,
Edsel
Hello Edsel,
You are right: it is not an blank view, so that's the reason why this.scope._$ds.filter(filter) works.
Thanks a lot
Wolfgang