<s:DataGrid id="materialsList">
<s:dataProvider>
<c:SortableAsyncListView list="{materials}" />
</s:dataProvider>
....
materials is PagedQuery.
When I'm sorting by GridColumn with complex dataField ("group.name") I'll getting sort[0]=null and procedure on server-side can't order materials by this field. How to sort SortableAsyncListView by complex field?
There is no reason why sorting would not work with complex field.
Which version of Flex SDK are you using ?
Related
I’m trying to create a new dataset type Powerapps Component (PCF). For the moment I am using it to display a view of the records that are available in an entity in Microsoft Dynamics CRM.
I wish to make the view sort itself when I click on the grid column headers (in a similar way that the default CRM grid view does). I'm trying to figure out how to apply a sort to the dataset so that I can refresh it as indicated by the documentation for the dataset.refresh() function:
Refreshes the dataset based on filters, sorting, linking, new column.
New data will be pushed to control in another 'updateView' cycle.
The dataset object does have a “sorting” property, but changing its value and then refreshing the dataset doesn’t seem to have any effect. After the refresh, the sorting property reverts to the value it had before I changed it.
In short, the click handler for the grid header does something like the following bit of code. The refresh gets done and my updateView() function gets called as expected but the sorting was not applied.
dataset.sorting = [{name: 'createdon', sortDirection: 1}];
dataset.refresh();
Any help on getting the dataset sorting to work would be appreciated.
I've been experimenting with PowerApps Component Framework a little bit recently and I can confirm that the following code won't be working:
dataSet.sorting = [ { name: "columnName", sortDirection: 0 } ];
However, I managed to get this one working for me:
dataSet.sorting.pop(); // you may want to clean up the whole collection
dataSet.sorting.push({ name: "columnName", sortDirection: 0 });
I haven't really figured out the reason of this behavior. The sorting array may be implemented as some form of observable collection in the background.
I hope this will guide you to a functioning solution.
The documentation is pretty abysmal here, but here is my best guess from putting a few different pieces of information together.
TLDR: I think there is some kind of extra method that needs to be called on the .sorting property, but I can't find out what it is called. Maybe something like:
dataset.sorting.setSorting({name: 'createdon', sortDirection: 1});
I think you're going to have to try a bunch of likely method names and see what works.
Background and links:
The only reference I could find to dataset.sorting was from here:
In this preview for canvas apps, only a limited set of filtering and sortStatus methods are supported. Filter and sort can be applied to dataset on primary type columns except for the GUID. Filter and sorting can be applied in the same way as in model-driven apps.To retrieve the dataset with filtering and sorting information, call
the methods in context.parameters.[dataset_property_name].filtering
and context.parameters.[dataset_property_name].sorting, then invoke
the context.parameters.[dataset_property_name].refresh().
So it seems that the .filtering and .sorting properties are handled similarly, and that there are some methods attached to them, and only some are supported. That is about as vague as they could make it...
I did find an example of how .filtering is used:
_context.parameters.sampleDataset.filtering.setFilter({
conditions: conditionArray,
filterOperator: 1, // Or
});
There is a brief reference to .setFilter() in the docs, as well as FilterExpression
There is a SortStatus reference, but it doesn't have any corresponding methods explicitly called out. It is possible that this is not yet a supported feature in the public preview, or the documentation is lacking and the name and syntax of the method you need to call on .sorting is not yet documented.
I have a list of TestRecord objects in velocity which have a method getDateExecuted which returns a java.util.date object. I would like to sort the Records by date using the sort tool.(or appropriate sorting algorithm) However I have not seen any implementations of the sort tool that aren't using an xPath node as the list argument. If the sort tool can not be used any information on creating a bubble/selection sort using only foreach loops would be helpful.
sort tool documentation:
http://velocity.apache.org/tools/devel/apidocs/org/apache/velocity/tools/generic/SortTool.html
http://www.hannonhill.com/kb/Script-Formats/#sort-tool
Add the SortTool object to the context:
context.put("sortTool", new SortTool());
In the template, you can get the sorted list (sorted by dateExecuted) as :
#foreach($testRecord in $sortTool.sort($testRecordList, "dateExecuted:asc"))
$testRecord.dateExecuted
#end
It is clearly specified in the SortTool documentation
http://velocity.apache.org/tools/devel/apidocs/org/apache/velocity/tools/generic/SortTool.html
Let me know for any issue
We would like to perform a spatial search on one geo field but distance sort the results based on a second geo field. It seems that Solr supports this for the LatLonType. Here we simply add parameters to the geodist function.
The geodist(param1,param2,param3) function supports (optional) parameters:
param1: the sfield
param2: the latitude (pt)
param3: the longitude (pt)
Unfortunately, this doesn't seem to work with the SpatialRecursivePrefixTreeFieldType. However, we have to use SpatialRecursivePrefixTreeFieldType since we have several locations for each document and this is not supported for the LatLonType. Is there any solution other than writing our own field type?
Finally I figured it out. However, the solution is a bit of a hack. I've now created a plugin jar that contains a modified version of the GeoDistValueSourceParser class. Within this class I've modified the method parseSfield to simply use a constant sfield, which should be used for sorting. Then I've hooked the class up by adding the line
<valueSourceParser name="customdist" class="bla.search.function.distance.CustomGeoDistValueSourceParser"/>
to the solrconfig.xml. So far I don't understand why the GeoDistValueSourceParser isn't configurable? It shouldn't be too difficult to write it in a way that a different geo field can be specified for sorting.
I have domain object named Roll and on the list page i want to show the user all the Roll objects iterating through a list, sorted by entry date.
Here is the code i am using
[rollList: Roll.findAll(sort:"rollDate"){userid==uid}]
rollDate is a field inside the Roll object with data type java.util.Date
Any suggestion on why the output is not sorted by rollDate. When i iterate through the rollList on the gsp page it is not sorted.
Also, on the Roll domain object i have even put this code, but it's still not sorting.
static mapping = {
sort "rollDate"
}
Thank you.
Why aren't you using the dynamic finders?
Roll.findAllByUserid( uid, [ sort:"rollDate", order: 'desc'] )
should work.
The findAll( Map, Closure ) method appeared not a long time ago, perhaps it was not tested well...
You might need to use order in your query as well, then add order to it
[rollList: Roll.findAll(sort:"rollDate", order: 'desc'){userid==uid}]
After trying both the solutions mentioned it still didn't work. So i thought something might be wrong on the front end.
While researching more i found that since i was using jquery data tables it used to re order the sorting. The solutions i found was here
jQuery DataTable rows order
So both the answers above are correct. The issue was actually with jquery data tables.
I want to build custom filtering header for Vaadin tables.
Can you please give some examples or solution to this problem.
I want to add a combo box or check box that will refine the search in the table like Excel columns.
We faced the problem of adding custom filters for Vaadin Table in our project as well.
As a solution we added a dynamic filter form above the table. It has become flexible and agile enough to apply filters.
We created Vaadin Addon in order to share our solution - Lexaden Grid.
You can find more information by the following link:
http://www.lexaden.com/main/entry/lexaden_grid
At the moment it is quite hard to add a custom component to do filtering with to the header of a table. It would require you to make your own version of Table by inheritance/copy&paste (not sure what is enough), and that is something most people wan't to avoid at the moment if anyway possible. The current implementation of the Table component is one of the most complicated components of Vaadin. It is doable if you insist putting components in header, but prepare for some serious thinking to get things to work.
I'd suggest making the filtering of data in containers with components just next/above your table. Hiding the table header is sometimes acceptable if there's no crucial information shown there. If you want something precisely on the header, it would require some empty headers and CSS positioning components on correct place.
You can always group table and other filtering components to one CustomComponent for easier abstraction.
Book of Vaadin is a very good reference for vaadin implementation. The link consist of an example code like:
// Define the properties
table.addContainerProperty("lastname", String.class, null);
table.addContainerProperty("born", Integer.class, null);
table.addContainerProperty("died", Integer.class, null);
// Set nicer header names
table.setColumnHeader("lastname", "Name");
table.setColumnHeader("born", "Born");
table.setColumnHeader("died", "Died");
Is this what you ask for? If it isn't, can you please specify your question a bit more clearly?
edit: Vaadin Sampler also contains handful code samples.