重写java多巴哥表排序方法不显示数据
我创建了一个包含多巴哥表的 Java Web 应用程序。我现在尝试使用 sortActionListener 属性覆盖工作表的排序机制。
当我单击某一列时,我的排序方法就会启动。我可以读出列名并执行一些 SQL 操作来获取我现在想要显示的数据。排序是通过 SQL 查询完成的。问题是,工作表不会显示数据,它是空的。
这是我收到的错误消息:
org.apache.myfaces.custom.ajax.api.AjaxPhaseListener - 发现组件没有ajaxComponent
有人知道如何解决这个问题吗?我的工作表是否必须启用 ajax 之类的功能,或者有什么问题吗?
提前致谢!
更新:
我发现错误消息是由于 tomahawk-sandbox 库和 tobago 之间的冲突造成的。删除沙箱库后,错误消息消失。尽管如此,我的观点仍然存在问题。
如果我手动跳过事件处理程序,一切都会正常,因为 jsp 页面将在事件处理程序之后重新加载。这是完美的。但是,如果我自行运行代码而不执行手动单步执行,则 jsp 页面不会重新加载,因此我看不到数据。
为什么会这样?我如何说服我的代码刷新 jsp 页面以及工作表? ;)
I have created a Java webapplication containing a tobago sheet. I am now trying to override the sorting mechanism of the sheet by using the sortActionListener attribute.
When I click on a column my sorting method is started. I can read out the column name and do some SQL stuff to get the data I would like to display now. The sorting is done due to the SQL query. The problem is, that the sheet won't display the data, it's empty.
This is the error message I get:
org.apache.myfaces.custom.ajax.api.AjaxPhaseListener
- Found component is no ajaxComponent
Has anybody an idea how to solve this? Does my sheet have to be something like ajax-enabled or what is wrong?
Thanks in advance!
UPDATE:
I have found out that the error message is due to a conflict between the tomahawk-sandbox library and tobago. After removing the sandbox lib, the error message disappears. Nevertheless I am still having problems with the view.
In case I step over the event handler manually everything works fine, since the jsp page will be reloaded after the eventhandler. This is perfect. BUT if I run the code on its own without performing a manual step over, the jsp page is NOT reloaded and therefore I can't see the data.
Why is this so and how can I persuade my code to refresh the jsp page and therefore the sheet? ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了显示结果,有必要与工作表本身进行交互 - 这在某种程度上是有意义的;)
仅此而已;)获取工作表的值,执行 SQL 查询并将结果发送到sheetData 对象。完成后,工作表将被刷新。
但我决定放弃 SQL 查询,因为它需要花费大量时间(非常庞大且复杂的数据库,不要问...)。我现在正在通过创建一个比较器来走标准的路。
比较器可以对我想要的任意多个字段进行排序,而且速度很快;)您还可以在排序列中查看工作表的状态(升序/降序),这不会用我的第一种方法(SQL 查询)显示。
In order to show up the results it is neccessary to interact with the sheet itself - which somehow makes sense ;)
That's all ;) Get the value of the sheet, perform the SQL query and send the result to the sheetData object. The sheet will be refreshed when it's finished.
But I decided to get rid of the SQL query since it takes a lot of time (very huge and complex database, don't ask ...). I am now going the standward way by creating a comparator.
The comparator can sort as many fields as I want and its fast ;) You can also see the sheet's state (ascending/descending) within the sortcolumn, which won't be shown with my first approach (SQL query).