Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Need Help to reload right data in EditFrame

Help
2011-12-19
2012-12-13
  • Need help:

    I have gridFrame with any important data of rows.
    To insert new data I am using EditFrame as OS stanadards.
    In my Insert operation, I do same calculate process in Data Base and this new data i should show in EditFrame.

    Problem:
    When inserting new record in  grid.getSelectedRow is 0 (first row)
    new data is inserting as new record in DataBase and in GridFrame as new row.

    When i execute reloadData in EditFrame Controler to load stored in DataBase data. EditFram is loading rowNum = 0 from GridFram and not new inserted record.

    When I do not execute (as mentioned above)
    editFrame.getMainPanel().reload() in afterInsertData()
    and pressing RELOAD BUTTON data is refreshed correctly.

    In wich way can I obtein this result automatically. without user interaction.

    Grateful for suggestions how to sole my problem or am I doing wrong directions

    Best Greetings for all
    Mietek

     
  • Problem solved,
    A suppose there are more then this way to solve isse.

    Is this right way? i don't know… but work….

    I was applay this code:

    @Override
    public void afterInsertData() {
    super.afterInsertData();
    SwingUtilities.invokeLater(new Runnable(){
        public void run() {
            editFrame.getMainPanel().reload();
                }
    });
    }

    Merry Christmas
    Wesolych Swiat Bozego Narodzenia