Wicket Database Dropdown Editor


Is there an existing class in the SDK for a Wicket database dropdown editor? I wasn’t finding anything in the Javadoc but it’s a component I see that’s commonly used in the gateway config pages…

You don’t configure the dropdown, you just add a ReferenceField to your PersistentRecord and include it on the page - the RecordEditForm will automatically create the dropdown.

    public static final LongField DatasourceId = new LongField(META, "DatasourceId", SFieldFlags.SMANDATORY);
    public static final ReferenceField<DatasourceRecord> Datasource =
        new ReferenceField<>(META, DatasourceRecord.META, "Datasource", DatasourceId);
    public static final Category Main = new Category("AlarmJournalRecord.Category.Main", 50).include(

Take a look at com.inductiveautomation.ignition.gateway.web.components.editors.ReferenceEditorSource if you’re curious how it works.

There’s also the EnumField. For Enums, naturally.

1 Like

Perfect thank you Paul/Phil. For those ReferenceFields, how would I setup the getter/setter to access that field directly from my Persistent Record? Do I need to specifically query that reference if I want to use it?

Yeah - just look up the relevant record using the ID record paired with the ReferenceField:

                DatasourceRecord dsr = context.getPersistenceInterface()
                    .find(DatasourceRecord.META, dbSettings.getLong(DatabaseJournalRecord.DatasourceId));

Sweet, what I ended up doing (because I won’t want to have to pass my gateway context around with my settings everywhere) was overriding the onQueryRecord() method:

 * Eagerly load references while SimpleORM session is still active.
protected void onQueryRecord() {