Reputation: 31
GXT - How can I add the Grid Filter parameters to the Request URL (get parameters)?
final PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy, reader) {
@Override
protected Object newLoadConfig() {
BasePagingLoadConfig config = new BaseFilterPagingLoadConfig();
return config;
}
};
=
Request URL:http://localhost/index.php?action=getLines&limit=10&sortField=null&offset=0&sortDir=NONE&filters=[com.extjs.gxt.ui.client.data.BaseStringFilterConfig@3abbafc7]
filters=[com.extjs.gxt.ui.client.data.BaseStringFilterConfig@3abbafc7] ???
How can convert this line for a request url?
Thanks!
Upvotes: 1
Views: 693
Reputation: 157
in HttpProxy there is this method
protected String generateUrl(C loadConfig) {
if (writer != null) {
return writer.write(loadConfig);
} else {
if (loadConfig == null) {
return "";
}
return loadConfig.toString();
}
}
So, if you have defined a DataWriter for your HttpProxy with the method setWriter it will be used, if not the toString method is used. There is a DataWriter - UrlEncodingWriter which I believe you need here
Upvotes: 0
Reputation: 964
It sounds like a toString method is missing in the BaseStringFilterConfig in order to use it as you describe.
Make sure you use a BaseStringFilterConfig that defines the toString method - to do so, you'd have to overwrite it manually.
Create a class that extends the BaseStringFilterConfig class and overrides the toString() method.
As an example you could use a private static final class BaseStringFilterConfigWithStringRepresentation extends BaseStringFilterConfig {
@Override
public String toString() {
return "[field=" + getField() + "| comparison=" +
getComparison() + " | type=" + getType() + " | value=" +
getValue() + "]";
}
}
Be careful not to use a comma as a delimiter, as the filters field already comes as a comma delimited list. You'd have to parse it on the server-side somehow and then return correct result.
Upvotes: 1