Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table set default sort column #66

Closed
simerlec opened this issue Jun 20, 2017 · 4 comments
Closed

Table set default sort column #66

simerlec opened this issue Jun 20, 2017 · 4 comments
Assignees
Milestone

Comments

@simerlec
Copy link

Hello,

this might be a pretty easy question but I cannot find an answer for it in the code.

Is there a way to set a specific column as the default sort - if I have a table with a few columns I want to have the table sorted after the first column by default.

thanks and kind regards

@simerlec
Copy link
Author

simerlec commented Jul 3, 2017

Made myself a quick workaround to this problem:

myTable.getColumns().get(0).setDefaultSortAscending(false);   //set ascending/descending order
JQueryElement $tableHeader = $(myTable);
clickElement($tableHeader.find(".table-header").get(0));

public static native void clickElement(Element elem) /*-{
        elem.click();
}-*/;

@BenDol BenDol self-assigned this Jul 25, 2017
BenDol added a commit that referenced this issue Jul 29, 2017
@BenDol
Copy link
Contributor

BenDol commented Jul 29, 2017

Can now auto sort columns in the latest 2.0 snapshot:

table.addColumn(new TextColumn<Person>() {
	...

        @Override
        public boolean autoSort() {
            return true;
        }

	...
});

@BenDol BenDol added the ready label Jul 29, 2017
@simerlec
Copy link
Author

Just tried to use the new feature and it does not seem to work for me - table is still unsorted.

Gonna try it in a new project as soon as I have time, to see if it's an issue with my current project.

Thanks

@BenDol
Copy link
Contributor

BenDol commented Jul 31, 2017

Should be working fine, let me know if you figure out how to reproduce the issue. Will reopen soon.

@BenDol BenDol closed this as completed Jul 31, 2017
@BenDol BenDol added this to the 2.0 milestone Jul 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants