on ‎2016 Apr 27 11:23 AM
Hi,
I am using the SearchField to swiftly filter values in a large list. The list initially had 1023 entries and it worked fine. Now, the list has grown to 9963 entries and it has stopped working. Are there any SearchField limits? If yes, what are they?
Thanks!
Request clarification before answering.
Update - I have now found the problem. It has nothing to do with the number of entries. The problem occurs when the column data from the model contains numbers only, for example 3026.
Question, how can I force the binding to be of type String for my column?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Frederico,
thanks for your reply. As you can read above I have used a Formatter in the view (when setting the value of the control). It did not work, but I will try again. Perhaps, I should do it ealier in the code, e.g. in the controller. Where in the code would you add the Formatter call?
Hi Frederico,
as I mentioned above, it does not seem to work for me. I use XML:
<StandardListItem
title="{path: 'someTitle', type : 'sap.ui.model.odata.type.String'}"
description="{path: 'someDesc'}"
type="Navigation"
press="onSearchListItemPressed"
iconDensityAware="false"
iconInset="false"/>
Other option I have tried is using a custom formatter:
<StandardListItem
title="{path: 'someTitle', type : 'formatter: 'zink.utils.StringFormatter.stringFormat''}"
description="{path: 'someDesc'}"
type="Navigation"
press="onSearchListItemPressed"
iconDensityAware="false"
iconInset="false"/>
The code of my custom formatter, StringFormatter.js looks like this:
sap.ui.define([
'sap/ui/model/type/String'
], function (String) {
"use strict";
var StringFormatter = {
stringFormat : function (v) {
return v.toString();
}
};
return StringFormatter;
}, /* bExport= */ true);
Anyway, it seems that the type change is done too late and therefore it has not impact on the filter. I would like to force the data type when binding the model, but I am not sure how to do that ...
Yes, the function is reached. As mentioned earlier in this thread, I have even changed all the vakues to "test", but that did not change the issue from occuring, which is why I want to change the data before binding of the values and then adding to the filter.
A far thought, could two-way binding perhaps help ...?
The error message I get is: Only "String" values are supported for the FilterOperator: "Contains". It leads me to think that it might be related to the data and not the volume.
How can I force the binding to be of type string of my model data for a specific column?
Here is my present code:
// filter list binding
var list = this.getView().byId("myList");
var binding = list.getBinding("items");
binding.filter(myFilters, "Application");
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sai,
thanks, we both had the same thought and I have now tested using a formatter. In fact, I replaced all the strings with "Test" and it results in the same error, i.e. it has nothing to do with the actual values and must be something with the size of the list. I will dig a bit further and keep the thread posted.
Hi Sergio,
thanks for your reply, here is the filter code, hope you find something fishy or can help me force the column to be of type string:
var aFilters = [];
var sQuery = oEvt.getSource().getValue();
if (sQuery && sQuery.length > 0) {
var filter = new Filter("someColumnName", sap.ui.model.FilterOperator.Contains, sQuery);
aFilters.push(filter);
}
// Update list binding with filter
var list = this.getView().byId("searchList");
var binding = list.getBinding("items");
binding.filter(aFilters, "Application");
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.