Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » [neon] is there a new way of setting "checked"-status for table rows in neon? [solved]
[neon] is there a new way of setting "checked"-status for table rows in neon? [solved] [message #1754410] Fri, 17 February 2017 12:14 Go to next message
Nils SFriend
Messages: 2
Registered: February 2017
Junior Member
Hello Smile

We've recently migrated from Mars to Neon and now some code that sets the "checked"-status for newly-created table rows has stopped working.
Previously, when creating table rows from data we could just use the checkRow method of the table like so:
table.checkRow(row, dto.isSelected());

This now results in the checked-status not being set and an IllegalArgumentException ("... only accept InternalTableRow, not class org.eclipse.scout.rt.client.ui.basic.table.TableRow ...") being thrown.
My first idea was that maybe I needed to add the row to the table before checking it (in Mars, you could check rows that were not in the table) but that does not work either.

Sooo... is there a new way to do this? Or some kind of trick to get it to work?

Thanks in advance

Nils

[Updated on: Tue, 21 February 2017 07:43]

Report message to a moderator

Re: [neon] is there a new way of setting "checked"-status for table rows in neon? [message #1754604 is a reply to message #1754410] Mon, 20 February 2017 19:50 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 205
Registered: November 2010
Senior Member
Nils,

Here is an example showing two ways to correctly add a row and check it at the same time:

@Order(10)
    public class SimpleTableField extends AbstractTableField<SimpleTableField.Table> {

      @Override
      protected int getConfiguredGridH() {
        return 10;
      }

      public class Table extends AbstractTable {

        @Override
        protected boolean getConfiguredCheckable() {
          return true;
        }

        public TestColumn getTestColumn() {
          return getColumnSet().getColumnByClass(TestColumn.class);
        }

        @Order(10)
        public class TestColumn extends AbstractStringColumn {

          @Override
          protected String getConfiguredHeaderText() {
            return "Test";
          }
        }
      }
    }

    @Order(10)
    public class InsertAndCheckMenu extends AbstractMenu {

      @Override
      protected String getConfiguredText() {
        return "Insert and check";
      }

      @Override
      protected void execAction() {
        SimpleTableField.Table table = getFieldByClass(SimpleTableField.class).getTable();

        // This will work
        ITableRow row = table.addRow();
        table.getTestColumn().setValue(row, "[1] The date is: " + new Date());
        table.checkRow(row, true); // or row.setChecked(true);

        // This will not work...
        ITableRow row2 = table.createRow();
        table.getTestColumn().setValue(row2, "[2] The date is: " + new Date());
        row2.setChecked(true);
        // ...but now it does
        ITableRow row3 = table.addRow(row2);
        row3.setChecked(true);
      }
    }


I'm not quite sure why the "row2" case does not work, but apparently, the checked flag is not considered when a "normal" table row is added to the table (and thus converted to an "internal" table row). I think you have hit a small bug. If we find the time, we will look into this issue. Thanks for bringing it to our attention.

I hope in the mean time, you can work around this problem using one of the above approaches.

Regards,
Beat
Re: [neon] is there a new way of setting "checked"-status for table rows in neon? [message #1754627 is a reply to message #1754604] Tue, 21 February 2017 07:39 Go to previous message
Nils SFriend
Messages: 2
Registered: February 2017
Junior Member
Hi Beat

Thanks for the help and the code sample, doing it the way you suggested it now works as expected Smile

Thanks again and have a great day

Nils
Previous Topic:Wizards for New Scout elements don't find sources
Next Topic:[neon] Closeable views
Goto Forum:
  


Current Time: Fri Apr 19 16:50:03 GMT 2024

Powered by FUDForum. Page generated in 0.01893 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top