天道酬勤,学无止境

Set default sort order for initial header click on gwt cell table

I have a GWT CellTable with sortable columns very similar to the developer's guide example (http://code.google.com/webtoolkit/doc/latest/DevGuideUiCellTable.html#columnSorting).

However, I would like to have certain columns sort descending instead of ascending by default. That is, if column A is not currently sorted and I click on it's header, I want column A to be sorted descending on that first click and ascending on the second click. But I do still want other columns to sort as they currently do - using ascending order on the first click.

Aside from the Column.setSortable(boolean) method to set sortability and the ColumnSortList.push(ColumnSortInfo) method to manually trigger a sort, there doesn't seem to be much control over the process.

Is there a way to accomplish this goal?

评论

Column.setDefaultSortAscending(false) is the easy way to do this; no custom CellTable required.

I was able to extend CellTable to do exactly what I wanted basically by overriding the onColumnSort(ColumnSortEvent) method of the ListHandler associated with the table. This is the meat/potatoes of the implementation. I had to do a little maintenance under the covers to keep track of whether or not a column had been sorted when you are about to sort it again.

One thing that confused me (and was not clear in google's examples) was that using the ColumnSortList.push() method does not actually trigger a sort like clicking does, but instead just changes the underlying state of how the column thinks it is sorted.

When I was ready to utilize this table I made, I basically did the following:

SortedCellTable<MyRowObject> table = new SortedCellTable<MyRowObject>();
table.addColumn(colOne, "one", true); // sortable column
table.addColumn(colTwo, "two", true); //sortable column
table.addColumn(colThree, "three", false); // unsortable column

table.setDefaultSortOrder(colOne, true); // sorts ascending on first click
table.setDefaultSortOrder(colTwo, false); // sorts descending on first click

table.setInitialSortColumn(colTwo); // sort this column as soon as data is set

table.setComparator(colOne, colOneComp); // use this comparator when sorting colOne
table.setComparator(colTwo, colTwoComp); // use this comparator when sorting colTwo

panel.add(table); // add the table to our view
// ...sometime later, asynchronously...
table.setList(myRowObjectList);

Here is the SortedCellTable implementation:

public class SortedCellTable<T> extends CellTable<T> {
/**
 * To keep track of the currently sorted column
 */
private Column<T, ?> currentlySortedColumn;
/**
 * Tells us which way to sort a column initially
 */
private Map<Column<T, ?>, Boolean> defaultSortOrderMap = new HashMap<Column<T, ?>, Boolean>();
/**
 * Comparators associated with their columns
 */
private Map<Column<T, ?>, Comparator<T>> comparators = new HashMap<Column<T, ?>, Comparator<T>>();
/**
 * Column to sort when the data provider's list is refreshed using
 * {@link SortedCellTable#setList(List)}
 */
private Column<T, ?> initialSortColumn;
/**
 * Data provider we will attach to this table
 */
private ListDataProvider<T> dataProvider;
/**
 * Special column sorting handler that will allow us to do more controlled
 * sorting
 */
ListHandler<T> columnSortHandler;

public SortedCellTable() {
    super();
    dataProvider = new ListDataProvider<T>();
    dataProvider.addDataDisplay(this);
    columnSortHandler = new ListHandler<T>(dataProvider.getList()) {

        @Override
        public void onColumnSort(ColumnSortEvent event) {
            @SuppressWarnings("unchecked")
            Column<T, ?> column = (Column<T, ?>) event.getColumn();
            if (column == null) {
                return;
            }

            if (column.equals(currentlySortedColumn)) {
                // Default behavior
                super.onColumnSort(event);
            } else {
                // Initial sort; look up which direction we need
                final Comparator<T> comparator = comparators.get(column);
                if (comparator == null) {
                    return;
                }

                Boolean ascending = defaultSortOrderMap.get(column);
                if (ascending == null || ascending) {
                    // Default behavior
                    super.onColumnSort(event);
                } else {
                    // Sort the column descending
                    Collections.sort(getList(), new Comparator<T>() {
                        public int compare(T o1, T o2) {
                            return -comparator.compare(o1, o2);
                        }
                    });
                    // Set the proper arrow in the header
                    getColumnSortList().push(
                            new ColumnSortInfo(column, false));
                }
                currentlySortedColumn = column;
            }
        }

        @Override
        public void setComparator(Column<T, ?> column,
                Comparator<T> comparator) {
            comparators.put(column, comparator);
            super.setComparator(column, comparator);
        }

    };
    addColumnSortHandler(columnSortHandler);
}

/**
 * Adds a column to the table and sets its sortable state
 * 
 * @param column
 * @param headerName
 * @param sortable
 */
public void addColumn(Column<T, ?> column, String headerName,
        boolean sortable) {
    addColumn(column, headerName);
    column.setSortable(sortable);
    if (sortable) {
        defaultSortOrderMap.put(column, true);
    }
}

/**
 * Adds a column to the table and sets its sortable state
 * 
 * @param column
 * @param header
 * @param sortable
 */
public void addColumn(Column<T, ?> column, Header<?> header,
        boolean sortable) {
    addColumn(column, header);
    column.setSortable(sortable);
    if (sortable) {
        defaultSortOrderMap.put(column, true);
    }
}

/**
 * Sets the column to sort when the data list is reset using
 * {@link SortedCellTable#setList(List)}
 * 
 * @param column
 */
public void setInitialSortColumn(Column<T, ?> column) {
    initialSortColumn = column;
}

/**
 * Sets a comparator to use when sorting the given column
 * 
 * @param column
 * @param comparator
 */
public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
    columnSortHandler.setComparator(column, comparator);
}

/**
 * Sets the sort order to use when this column is clicked and it was not
 * previously sorted
 * 
 * @param column
 * @param ascending
 */
public void setDefaultSortOrder(Column<T, ?> column, boolean ascending) {
    defaultSortOrderMap.put(column, ascending);
}

/**
 * Sets the table's data provider list and sorts the table based on the
 * column given in {@link SortedCellTable#setInitialSortColumn(Column)}
 * 
 * @param list
 */
public void setList(List<T> list) {
    dataProvider.getList().clear();
    if (list != null) {
        for (T t : list) {
            dataProvider.getList().add(t);
        }
    }

    // Do a first-time sort based on which column was set in
    // setInitialSortColumn()
    if (initialSortColumn != null) {
        Collections.sort(dataProvider.getList(), new Comparator<T>() {

            @Override
            public int compare(T o1, T o2) {
                return (defaultSortOrderMap.get(initialSortColumn) ? 1 : -1)
                        * comparators.get(initialSortColumn)
                                .compare(o1, o2);
            }

        });
        // Might as well get the little arrow on the header to make it
        // official
        getColumnSortList().push(
                new ColumnSortInfo(initialSortColumn, defaultSortOrderMap
                        .get(initialSortColumn)));
        currentlySortedColumn = initialSortColumn;
    }
}
}

Take a look at GWT CellTable columnsorting. (Someone voted it down because he/she did not agree with my approach?)

It is not the answer to your question, but it advocates that you get to the basics of Celltable before attempting anything illustrated by the celltable examples.

By getting to understand the basic behaviour and requirements of Cell/Grid tables, the sorting of columns will manifest itself clearly.

The sorting is performed by your supplying an implementation of comparator. On my part, I had tried a few ways of implementing comparator to suit the various ways I wanted columns sorted.

instead of

someTable.getColumnSortList().push(provider.getDefaultSortColumn());

use

someTable.getColumnSortList().push(new ColumnSortInfo(provider.getDefaultSortColumn(), false));

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • 如何在标题中通过几种方式对一列进行排序?(How to sort one column via several ways in a header?)
    问题 我有来自motti的表排序器,我找不到一种简单的方法可以从同一标头中的2个不同的热门区域以一种以上的方式对特定的列进行排序。 (一种通过“游戏名称”的方式,另一种通过“百分比”的方式。) 我的代码已经按游戏名称对Game进行了排序,但是单击百分比时它的作用相同(因此后者不是按百分比而是按名称)。 最少的编码方式是什么? (最好是使用现有的tablesorter选项。) 表标题列: <th>Game <span class="percSort">%</span></th> 正文栏: <th class="gamename"> <div style="width:66%;background-color: hsla(84,100%,50%,0.7);"></div> <span class="name">Alphabetic</span> <span class="perc">66%</span> </th> Domready代码: $("#games") .tablesorter({ sortList: [['.percSort',1]], textExtraction:{ 1:function(node, table, cellIndex) { return $(node).find('.name').text(); }, '.percSort':function(node
  • 如何对具有输入元素的列进行排序?(How can I sort columns having input elements?)
    问题 我有一张这样的桌子: | Update | Name | Code | modification date | | | name1 | code1 | 2009-12-09 | | | name2 | otehercode | 2007-09-30 | “更新”列包含复选框<input type='checkbox' /> 。 复选框的初始状态是在呈现表之前确定的,但是在从数据库中获取行之后才确定(它基于服务器端的一组条件)。 该复选框可以默认选中,默认不选中或禁用( disabled='disabled'作为input属性)。 我正在使用jQuery的Tablesorter对我的表进行排序。 我希望能够按包含复选框的列进行排序。 怎么可能(如果有帮助,我可以将一些其他属性传递给我的input元素)? 我应该编写自己的解析器来处理吗? 回答1 在输入之前添加一个隐藏的跨度,并在其中包含一些文本(将用于对列进行排序)。 就像是: <td> <span class="hidden">1</span> <input type="checkbox" name="x" value="y"> </td> 如果需要,可以将事件附加到复选框,以便在选中/未选中时修改前一个同级的内容(跨度): $(document).ready(function() { $('#tableid input')
  • Flutter DataTable 看这一篇就够了
    注意:无特殊说明,Flutter版本及Dart版本如下: Flutter版本: 1.12.13+hotfix.5Dart版本: 2.7.0 DataTable DataTable控件显示表格数据,DataTable需要设置行和列,用法如下: DataTable( columns: [ DataColumn(label: Text('姓名')), DataColumn(label: Text('年龄')), ], rows: [ DataRow(cells: [ DataCell(Text('老孟')), DataCell(Text('18')), ]), ], ) columns参数是DataTable的列,rows参数是DataTable的每一行数据,效果如下: [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PVJjFzIA-1583324581157)(/Users/mengqingdong/Library/Application Support/typora-user-images/image-20200303200953329.png)] 在添加一行数据,只需要添加一个DataRow即可,用法如下: DataTable( ... rows: [ DataRow(cells: [ DataCell(Text('老孟')), DataCell
  • 如何让jQuery Tablesorter默认降序排序?(How to get jQuery Tablesorter to sort descending by default?)
    问题 我想不通。 这个问题也在这里问 http://www.nabble.com/TableSorter-plugin---default-column-sort-DESC-instead--How--to25180761s27240.html#a25180761 没有回应。 我试过了 $.tablesorter.defaults.sortInitialOrder = 'desc'; 并将 jquery.tablesorter.js 文件更改为默认为“desc”,但它不起作用。 当我单击列标题时,第一个排序仍然是升序,因此用户必须单击两次才能降低值。 如何让 Tablesorter 默认按降序排序? 回答1 看起来像 tablesorter 代码中的错误,或者我误解了 sortInitialOrder 参数应该做什么。 在第 536 行,它通过查看列已排序的次数并取值 mod 2 来设置排序器顺序。它还应该考虑 sortInitialOrder 的值。 将第 536 行从 this.order = this.count++ % 2; 至 this.order = this.count++ == 0 ? this.order : (1 - this.order); 并在此行之后添加(以便第一次单击不同的列为您提供默认值) $headers.not($cell).each(
  • element-ui el-table 多列排序
    element-ui el-table 多列排序 需求:el-table 需要支持多列排序,后端排序。即就是在点击后重新发送请求,点击一列的排序,另一列的排序样式能够保留 问题: element table 排序默认是单列排序 最终实现效果: 思路: header-click 事件 结合 header-cell-class-name 在点击表头的时候排序的列以及是升降序保存到一个数组对象里, 然后通过header-cell-class-name属性设置选中的样式 <el-table :data="tableData.list" border size="mini" stripe :fit="false" :header-cell-class-name="handleHeaderClass" @header-click="handleHeaderCLick" @sort-change="handleTableSort" > <el-table-column v-for="(items, i) in dropCol" :key="`${tableColList[i].label}${dropCol[i].label}`" :prop="dropCol[i].label" :sortable="items.labelSupportSort === 1 ? 'custom' : false
  • vxe-table使用(第一节)
    vxe-table 一个全功能的 Vue 表格,满足绝大部分对 Table 的一切需求,与任意组件库完美兼容 因为公司项目需求,需要跟大数据还有表格汇总打交道,刚开始用的是组件element-ui,随着项目需求的增加,element-ui无法满足我所需要的,这个时候 vxe-table 进入了我的视线,接触了之后才发现他的功能是真的强大。 基础类型(大概的属性跟性能) 1、表格的边框(有三种形式) <vxe-table :data="tableData" border=true></vxe-table> border=none 去掉外部边框 border=false 只显示外边框 border=true 显示所有边框 不设置默认 border=false 只显示外边框 这三种样式可以解决大部分表格边框的样式需求 2、每一列文字的方向 (居左、居中、居右) <vxe-table :align="allAlign" :data="tableData"></vxe-table> 设置 属性 align “left”“center”“right” 3、序号 、列宽 、表格高度 序号 系统设置序号 type=seq 开启序号列 <vxe-table :data="tableData" type=seq> <vxe-table-column type="seq" width="60"><
  • CellTable with custom Header containing SearchBox and Focus Problem
    I am trying to implement a CellTable with a custom Column Header which displays a SearchBox (simple Textbox) below the normal Column text.The SearchBox should allow the user to filter the CellTable. It should look something like this: |Header 1|Header 2 | |SEARCHBOX|SEARCHBOX| ------------------------------------------------------- | ROW 1 ------------------------------------------------------ | ROW 2 As soon as the user types in a character into the SearchBox a RangeChangeEvent is fired which leads to a server requests and the CellTable is updated with the new filtered list. Basically
  • 如何使用GWT 2.1数据表示小部件(How to use GWT 2.1 Data Presentation Widgets)
    问题 在2010年的Google IO中,我们宣布GWT 2.1将包含新的数据表示小部件。 可以下载2.1M,大概包含了小部件,但尚未出现任何文档。 是否有使用它们的简短教程或示例? 我听说有传言说CellList和CellTable是有问题的类。 针对它们的Javadoc上充斥着许多TODO,因此在使用方面仍然遗漏了很多东西。 回答1 Google I / O 2010-GWT的UI大修 2.1中的javadocs包com.google.gwt.cell.client 里程碑2的Eclipse更新站点 当代码在Bikeshed中时,将此行添加到您的gwt.xml文件中: <inherits name='com.google.gwt.requestfactory.RequestFactory'/> 以下是以下示例: 具有PageSizePager的TextCells的CellList 具有SimplePager的TextCells的CellList 具有SimplePager和PageSizePager(buggy)的TextCell的CellList和带有String标头和TextCell标头的CellTable package dpw.client; import java.util.ArrayList; import com.google.gwt.cell.client
  • 是否可以防止弹出一个宜用的弹出菜单? 或者:如何通过单击单元格并返回行和列索引来获取回调?(Is it possible to prevent an uitable popup menu from popping up? Or: How to get a callback by clicking a cell, returning the row & column index?)
    问题 对于用户界面,我正在编写一个uitable 。 用户在第一列中选​​择选项A,B或C ,第二列中的子选项取决于在第一列中选​​择的内容,即A.1,A.2或A.3或B.1,B.2或B.3或C相同 该表的代码可以在附录A中找到。 当用户首先定义主选项时,子选项会自动相应地减少为仅有效选项。 这是通过评估第1列的CellEditCallback并重置第ColumnFormat列的ColumnFormat来实现的。(附录B中的function modifySelection )如果用户现在意识到自己犯了一个错误并且需要再次编辑子选项,则仍会根据ColumnFormat内容设置ColumnFormat :到先前编辑的主选项,除非他再次选择主选项,否则有效选项将不可用。 (请参见图片中的蓝色突出显示)。 为了解决这个问题,我还实现了CellSelectionCallback调用函数justifySelection (在附录B中),该函数通过选择进行检查,在第1列中选择了哪个选项,以再次为第2列提供正确的子选项。我需要选择两次,一次触发CellSelectionCallback ,另一次实际获取我的选择。 对于大桌子,这可能会很烦人! 所以我的问题是: 有没有一种方法可以防止第2列中的弹出菜单弹出,直到它发现第1列的内容是什么,以便它立即提供有效的选择? 或者:
  • 使用javascript或jquery根据表标题列对表行进行排序(Sorting table rows according to table header column using javascript or jquery)
    问题 我有这样的东西 <table> <thead> <tr> <th>S.L.</th> <th>name</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Ronaldo</td> </tr> <tr> <td>2</td> <td>Messi</td> </tr> <tr> <td>3</td> <td>Ribery</td> </tr> <tr> <td>4</td> <td>Bale</td> </tr> </tbody> </table> 我想是排序的<tr>的<tbody>当点击th升序和根据以下可选地降序th点击。 因此,如果有人点击了SL th就说明在下降,然后在每一次点击或者按升序排列表格行。 当点击Name th它应该显示按降序排列,然后没有在各自的变化升序名称SL 这是小提琴 回答1 您可能要查看此页面: http://blog.niklasottosson.com/?p=1914 我想你可以做这样的事情: 演示:http://jsfiddle.net/g9eL6768/2/ HTML: <table id="mytable"><thead> <tr> <th id="sl">S.L.</th> <th id="nm">name</th> </tr> .... JS: // sortTable(f,n) // f
  • gwt 单元格表动态列 - 排序(gwt cell table dynamic columns - sorting)
    问题 您可以将您的“行”表示为List<String>实例,您必须在您的 Grid、Column 和数据提供程序中将参数化从 String 更改为 List; 当然你必须用List<List<String>>调用 updateRowData ,而不是List<String> 。 您还需要每列一个 Column 实例,按索引从 List 中取出值: class IndexedColumn extends Column<List<String>, String> { private final int index; public IndexedColumn(int index) { super(new EditTextCell()); this.index = index; } @Override public String getValue(List<String> object) { return object.get(this.index); } } 我如何在这个例子中添加排序。 我尝试了ListHandler但不知道如何比较List<String> 。 任何帮助表示赞赏。 回答1 您需要为要单独排序的每一列添加一个ListHandler 。 有点像这样: 您必须为IndexedColumn添加一个 getter 方法以IndexedColumn index : class
  • MatSort breaks MatTable detail row animations
    I've been beating my head against this problem for quite a while before I got here. Essentially, I have an Angular Material table that uses animations to create a detail row. When the table sorts, it rearranges the data. Some of the detail rows have a transition to void during that process. Afterwards, the detail rows stop playing the animation, even though the animation events are firing. I suspect that MatSort is breaking the animations somehow, but I'm not sure how. Angular Material table: <mat-table matSort [dataSource]="tableData" multiTemplateDataRows> <!-- More Column --> <ng-container
  • JTable可点击列排序:排序对单元格的内容进行排序,但是不更新单元格格式吗?(JTable Clickable Column Sorting: Sorting sorts content of cells, but doesn't update cell formatting?)
    问题 我有一个可排序的JTable设置为使用AbstractTableModel的自定义扩展。 但是,该表的某些行为是我所期望的,并且我希望就如何弄清楚该表提供一些建议。 我已经将JTable设置为可以使用以下命令进行排序: thisJTable.setAutoCreateRowSorter(true); 这使我可以按预期通过单击列标题来对表进行排序。 但是,我发现当我通过单击列标题对表进行排序时,行的格式(背景色和前景色)也没有进行排序。 我已经将这些行设置为根据它们包含的值进行颜色编码。 当我按列标题排序时,给定行NUMBER的格式保持不变(尽管该行中先前的内容已移动)。 通过覆盖JTable的默认prepareRenderer调用来设置行的颜色: thisTable = new JTable(thisModel){ //Set up custom rendering - Sets background color of row to correct value public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); CustTableModel
  • D3.js尝试实现可排序的SVG表(D3.js trying to implement sortable SVG table)
    问题 如我的标题所述,我正在尝试实现具有良好过渡效果的交互式表格,这就是为什么我选择将D3.js与SVG元素结合使用的原因。 我设法用普通的HTML元素(th,tr,td)实现了一个可排序的表: http://jsfiddle.net/recek/q6LE6/ // create the table header var thead = d3.select("thead").selectAll("th") .data(d3.keys(jsonData[0])) .enter().append("th").text(function(d){return d;}) .on("click", function(d){ return refreshTable(d);}); // fill the table // create rows var tr = d3.select("tbody").selectAll("tr").data(jsonData); tr.enter().append("tr"); // create cells var td = tr.selectAll("td").data(function(d){return d3.values(d);}); td.enter().append("td") .text(function(d) {return d;}); /
  • D3.js trying to implement sortable SVG table
    As my title states I am trying to implement an interactive table with nice transitions, that's why I choose D3.js in combination with SVG elements. I managed to implement a sortable table with normal HTML elements (th,tr,td): http://jsfiddle.net/recek/q6LE6/ // create the table header var thead = d3.select("thead").selectAll("th") .data(d3.keys(jsonData[0])) .enter().append("th").text(function(d){return d;}) .on("click", function(d){ return refreshTable(d);}); // fill the table // create rows var tr = d3.select("tbody").selectAll("tr").data(jsonData); tr.enter().append("tr"); // create cells
  • HTML表格排序(HTML table sort)
    问题 因此,基本上我正在运行一个mysql查询,该查询从数据库中获取数据并以易于阅读的布局显示给用户。 Name-----Address----Sales Person 你明白了。 现在,我想让用户按销售人员对html表进行排序。 我如何使用下拉菜单轻松地做到这一点? <div class='menu'> <ul> <li><a href='#'><span>Sales Person</span></a> <ul> <li><a href='#'><span>Melissa</span></a></li> <li><a href='#'><span>Justin</span></a></li> <li><a href='#'><span>Judy</span></a></li> <li><a href='#'><span>Skipper</span></a></li> <li><a href='#'><span>Alex</span></a></li> </ul> </li> </ul> </div> 回答1 检查是否可以使用下面提到的任何JQuery插件。 简直很棒,并提供了广泛的选择来进行工作,并且减少了整合的烦恼。 :) https://github.com/paulopmx/Flexigrid-Flexgrid http://datatables.net/index-数据表
  • pyqt qt4 QTableView如何禁用某些列的排序?(pyqt qt4 QTableView how to disable sorting for certain columns?)
    问题 所以我有一个QTableView,我只想让列在第1列而不是在column2上进行排序。 当然,我想installEventFilter上QHeaderView或QTableView ,但MouseButtonPress没有被传递的事件,除非你installEventFilter上QApplication 现在,如果调用eventFilter ,则目标object始终是顶层窗口小部件,尽管event.pos()实际上是相对于标题或表单元格的,具体取决于您单击的位置。 因此,我们无法使用QHeaderView.rect().contains(event.pos())来确定用户是否单击标题,因为单击第一个表格单元格的顶部边缘时您会得到误报。 但是,您仍然可以使用globalPos进行计算,但是,当您更改布局或在tableview上方添加更多小部件时,eventFilter的逻辑必须更改。 我相信event.pos()返回相对pos是一个错误,即使object参数始终引用相同的顶级小部件。 更具逻辑性的API是可以使用event.target()方法返回目标,以在目标位置计算相对位置。 但是我看不到target()方法或在此事件过滤器中找到目标的方法。 也许我想念什么? # -*- coding: utf-8 -*- # pyqt windows 4.10.3 # python 2
  • In search of a GWT validation example… where art thou?
    As a follow-up to Why are there no decent examples of CompositeCell in use within a CellTable? I am trying to add-on JSR-303 validation support. I have followed Koma's config advice here: How to install gwt-validation with gwt-2.4.0 (Note: I'm using GWT 2.4's built-in validation, not GWT-Validation). Again, in order to get some re-use I crafted a pair of classes, ValidatableInputCell and AbstractValidatableColumn. I got inspiration for them from: http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/validation/src/main/java/com/google/gwt/sample/validation/client
  • Javascript: How to update a progress bar in a 'for' loop
    I am have an issue with a JS script I am trying to put together. I have an HTML table with somewhere in the neighborhood of 300 rows in it. I have made a sort function that will make the table headers clickable and launch my sort function. I would like to integrate a progress bar because in larger tables (500 - 1000 rows) after a header is clicked the table takes a bit of time to sort (IE is a big offender). The progress bar would tell them how much time remains before the sort is complete. The method I had in mind was a div element that I would resize based on the progression of the sort loop
  • JTable Clickable Column Sorting: Sorting sorts content of cells, but doesn't update cell formatting?
    I have a sortable JTable set up to use a custom extension of the AbstractTableModel. However, some behavior of this table is what I expected, and I would love some advice on how to figure this out. I have the JTable set up to be sortable using: thisJTable.setAutoCreateRowSorter(true); This allows me to sort the table by clicking on the column headers as expected. However, I find that when I sort the table by clicking on the column headers, the formatting (background and foreground color) of my rows are not sorted as well. I had set up those rows to be color-coded based on the values they