Replacing Standard Insert Method of NavigationTable

The NavigationTable has buttons for insert/update/delete and other standard functionality. You can replace standard functionality with your own methods, e.g., load a zip file and insert records parsed from the archive - instead of inserting a new, empty, record.

Here's an example screen (AddOns from VisionX):

If the user is pressing the + button beside the table, an open file dialog should appear, like this one:

After selecting a file, the file should be parsed and a new record with parsed information should be inserted in the table. The parsing will be done in a server-side method and the return value of the method will be inserted.

How is This Possible?

First, configure the databook:

rdbAddOns.eventAfterInserting().addListener(this, "doCancelInsert");
public void doCancelInsert() throws ModelException

Don't insert new records.

Configure the NavigationTable:

navAddOns = new NavigationTable();
navAddOns.eventInsert().addListener(this, "doNewAddOn");
public void doNewAddOn() throws Throwable
    getApplication().getLauncher().getFileHandle(this, "doInsertAddOn");
public void doInsertAddOn(IFileHandle pFileHandle) throws Throwable
    String sName = (String)getConnection().callAction("parseZip", pFileHandle);
        rdbAddOns.setValue("NAME", sName);

It also would be possible to use a custom storage implementation and simply do a reload:

public void doInsertAddOn(IFileHandle pFileHandle) throws Throwable
    String sObjName = rdbAddOns.getName();
    getConnection().call(sObjName, "insertArchive", pFileHandle);

The storage implementation could load all AddOns from the filesystem and not from the database.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information