|
Re: Table Menubar at top [message #1798067 is a reply to message #1797976] |
Mon, 12 November 2018 07:51 |
|
Miloslav Frajdl wrote on Fri, 09 November 2018 07:27I have question: Table menubar is rendered at bottom table by default. Can you render this menubar at top (before column headers)?
Yes, but not easily. As you may have noticed, the menubar can be at the top of a table, specifically at the desktop tables (table pages). Tables inside table fields on a form are rendered differently, e.g. they have smaller row height, lighter selection border - and the menubar is always drawn at the bottom.
The position can be controlled with the property "position", by calling the method top() or bottom() on the menubar object. (see default in Table.js) This is only possible in JavaScript, because the menu bar does not exist as a model object in Scout Classic. Are you using Scout Classic (with Java UI Server) or Scout JS (JavaScript only)? Basically you have to call table.menuBar.top() after the table widget is initialized. How this is achieved best depends on whether you want this behavior for all tables or just one specific instance, and if you are using Scout Classic or Scout JS.
Classic, all tables:
Create your own widget class MyTable.js/MyTableAdapter.js that extend from scout.Table/scout.TableAdapter and register it in the object factory. This tells Scout to use MyTable.js to create new instances of "Table" widgets.
scout.objectFactories = $.extend(scout.objectFactories, {
'Table': function() {
return new mynamespace.MyTable();
}
});
You can then override the _init() method and change the menubar position (don't forget the "super" calls).
Classic, single table:
Add the @ModelVariant("mynamespace.My") annotation to your Table class. This causes mynamespace.MyTable to be used for that specific widget.
ScoutJS, all tables:
Like classic, but the Adapter.js class is not needed.
ScoutJS, single table:
When creating the widget, pass your class name instead of "Table": scout.create('mynamespace.MyTable', ...)
Regards,
Beat
|
|
|
Powered by
FUDForum. Page generated in 0.02823 seconds