Thursday, June 21, 2012

Re: sorting celltable data with image

Can any one help me on this?

On Tue, Jun 19, 2012 at 5:42 PM, lucky <lucky.begumpet@gmail.com> wrote:
Hi,

I have a requirement that i need to sort celltable data with image, and also when i click on the image i need sort the data again.
Currently i am using the following code:
it will display image but i am not able to sort the data when i click on the image(Like down Arrow and UPArrow)

I am using gwt 2.4

Below is the code snippet:

 
   TextColumn<ResultProxy> nameColumn = new TextColumn<ResultProxy>() {
          @Override
          public String getValue(ResultProxy object) {
            return object.getName();
          }
        };
        resultListGrid.addColumn(nameColumn, "Name");

        nameColumn.setSortable(true);
  
  
   ListHandler<Proxy> columnSortHandler = new ListHandler<ResultProxy>(
                resultGrid);
            columnSortHandler.setComparator(nameColumn,
                new Comparator<ResultProxy>() {
                  public int compare(ResultProxy o1, ResultProxy o2) {
                    if (o1 == o2) {
                      return 0;
                    }

                    // Compare the name columns.
                    if (o1 != null) {
                      return (o2 != null) ? o1.getName().compareTo(o2.getName()) : 1;
                    }
                    return -1;
                  }
                });
            resultListGrid.addColumnSortHandler(columnSortHandler);
           resultListGrid.getColumnSortList().push(nameColumn);

Let me know do i need to any thing more?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/TsF7iT4xZdwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment