Firstly I'm using GXT 3.1.1 with GWT 2.6.1
I have a TreeStore which displays the items at a TreeGrid component and it is sorted like below:
//Sort the list alphabetically
treeStore.addSortInfo(new StoreSortInfo<BaseTreeGridDTO>(comparator, SortDir.ASC));
However, once it is already sorted and I add new elements to it, they are always placed at the end of the list.
Is there any way to add these new items to this sorted TreeStore where it can keep the alphabetical order?
Have you tried to call:
treeStore.applySort(true);
after you added the item to the store?
If you set SortInfo for a TreeStore, this will not work. You have to set for a ListStore.
For example, instead of using grid.getTreeStore(), use grid.getStore().
Related
I have one listobj which is Itext7 list
List listd = new List();
i want to remove the items from the above listd object.
I have tried but i was unable to find.
Could anyone help me on this?
All AbstractElement instances, including List, have getChildren() method. It gives you the list (collection) containing children of that instance. You can access that list directly and remove any child you want to.
E.g. if you execute this code:
List list = new List().add("One").add("Two").add("Three");
list.getChildren().remove(1);
Then you would end up with two items in the list, the first one ("One") and last one ("Three").
The code is for Java but if you are using C# then you should just adapt the part interacting with the IList interface which should be straightforward.
I've the following problem: in my TYPO3 backend (TYPO3 8.7.24) I've got multiple SysFoldern for my tt_products items (just to arrange everything a bit). But in the list view the sorting arrows are missing.
TYPO3-Backend-Sorting_ListView
TYPO3 was setup freshly in the version 8. For tt_products (v 2.9.4) I'm using the followig addition in the template.
plugin.tt_products.conf.tt_products.LIST.orderBy = sorting
You can allow manual sorting of products in the backend with TypoScript, but it is slightly different:
plugin.tt_products.conf.tt_products.orderBy = sorting
plugin.tt_products.conf.tt_products.LIST.orderBy = sorting works in frontend only. In the Backend sorting of the products is hard-coded to be by title. If you want to change it, you would need to adjust table definition ($TCA) with another extension.
You must configure tt_products in the backend settings (previously in the extension manager).
Order tables by sorting
basic.orderBySortingTables (string)
Enter this:
tt_products,tt_products_language
This will enable the sorting arrows in the backend list module.
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 have a line graph that is being updated every 5 seconds as new data is pulled from a mySQL database.
https://gist.github.com/Majella/5fc4cd5f41a6ddf2df23
How do I remove the first/oldest element from the array each time the data is called to stop the line/path being compressed?
I've tried adding data.shift() in the update function just after the data is called but only works for the first call?
I don't know the details of what lives behind getdata.php, but I assume it's returning progressively more data points each time, thus removing only the first one still lives you with a larger data set than you want. So you have a couple choices:
Change the server-side of getdata.php to return only the latest x data points (or maybe add a querystring parameter for how many points/minutes/whatever to retrieve)
Change the client-side in updateData to check the length of the array and .slice off the elements starting at lengthYouWant minus lengthYouReceived (assuming the data is already sorted correctly)
I am trying to test a list on a web page using Cucumber and Ruby.
The list changes (dependant on user input) basically, I want to grab all the item into an array - I then wan to ensure that the list is in alphabetical order. Ideas anybody
Use capybara's all method to find elements on page:
elements_array = page.all(:css, 'li')
See corresponding API docs.
Assuming you're using Capybara and CSS selectors, this will give you an array contains text of each element in the list:
list_items = page.all('li').collect(&:text)
If you're using RSpec you can confirm they are sorted with:
list_items.sort.should == list_items
(you might write a be_sorted RSpec matcher to make that cleaner).