GWT CellTable保持关注选定的行 [英] GWT CellTable keep focus on selected row

查看:132
本文介绍了GWT CellTable保持关注选定的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在包含多列的CellTable中选择一行时,整行会变成黄色。它不取决于我点击的行的哪个区域(行的哪一列)。

我所要做的是保持所选的行为黄色只要这张桌子上没有其他的行被选中。此刻,只要我点击浏览器中的其他地方,该行就会恢复其原来的颜色。



我尝试使用选择模型,但是这并没有改变。你有任何建议,或者这是不可能的,因为焦点是由浏览器管理?在CellTable的Google展示中,行为是相同的...

解决方案

选择模型实际上是做你想做的事:如果您单击页面中的其他位置,则会将行涂成蓝色,并且行不会更改颜色。 (仅在选择另一行时)

有两种选择模式:
一种可以让您选择一行,另一种让您选择多种行。

  MultiSelectionModel< Row> selectionModel = new MultiSelectionModel< Row>(); 
table.setSelectionModel(selectionModel);

SingleSelectionModel< Row> selectionModel = new SingleSelectionModel< Row>();
table.setSelectionModel(selectionModel);


When I select a row in a CellTable which contains several columns, the whole row gets colored in yellow. It does not depend on which area of the row I click (which column of the row).

What I try to do is to keep the selected row colored in yellow as long as no other row of this very table is selected. At the moment, as soon as I click somewhere else in the browser, the row gets back its original color.

I tried to use a selection model, but this changed nothing. Do you have any advise or is this simply not possible, since the focus is managed by the browser? The behavior is the same in the Google showcase for the CellTable...

解决方案

The selection model actually does what you want to do: it paints a row blue and the row does not change color if you click elsewhere in the page. (Only when another row is selected)

There are 2 selection models: One that lets you select only one row, and another one that lets you select multiple rows.

MultiSelectionModel<Row> selectionModel = new MultiSelectionModel<Row>();
table.setSelectionModel(selectionModel);

SingleSelectionModel<Row> selectionModel = new SingleSelectionModel<Row>();
table.setSelectionModel(selectionModel);

这篇关于GWT CellTable保持关注选定的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆