Page 1 of 1

Enable Editing Parts of an Order

Posted: Wed Aug 08, 2012 3:49 pm
by Valdus
As it states in the title I cannot get editing to be enable on parts of an order I have extended all the order view and presenters turning the read only setting off, yet it still will not let me edit them. Leading me to a follow up question do I have to extend the order entity so that I can enable editing or will I be able to edit the standard one?

Re: Enable Editing Parts of an Order

Posted: Thu Aug 09, 2012 11:36 am
by phillipuniverse
Can you post how exactly you extended the view/presenter? If you're just trying to edit the Order entity fields that appear in the list view on the left, in your subclassed setup() method you could do something like this:

Code: Select all


        getPresenterSequenceSetupManager
().addOrReplaceItem(new PresenterSetupItem("orderDS", new OrderListDataSourceFactory(), new AsyncCallbackAdapter() {
            public void onSetupSuccess(DataSource top) {
                setupDisplayItems(top);
                ((ListGridDataSource) top).setupGridFields(new String[]{"customer.firstName", "customer.lastName", "name", "orderNumber", "status", "submitDate"}, new Boolean[]{true, true, true, true, true, true});
                getDisplay().getListDisplay().getGrid().sort("submitDate", SortDirection.DESCENDING);
            }
        }));


That snippet will make all of the fields editable in the grid.

If you're trying to make the items in the form view on the right editable, there is 1 line at the end of the bind() method of OrderPresenter that is easy to miss on line 154:

Code: Select all


setReadOnly
(true)

In your subclass, you can add this:

Code: Select all

@Override
protected void bind
() {
    super.bind();
    setReadOnly(false);
}


Let me know if that helps.

Re: Enable Editing Parts of an Order

Posted: Thu Aug 09, 2012 11:58 am
by Valdus
I actually have both of those changes and yes the grid on the left is editable but the data in the form view is still actually locked.

Re: Enable Editing Parts of an Order

Posted: Thu Aug 09, 2012 2:45 pm
by Valdus
What I needed was more from the top, it turns out that unlike customer the order is broken down into much smaller parts so I just have to play around with enabling the correct systems for editing until I get the combination that I need.