3341 Posts in 982 Topics by 703 members
|Go to End|
4 April 2013 at 9:14am Last edited: 4 April 2013 10:22am
Playing about with the ModelAdmin and GridField on DataObjects. Theres a few things I would like to do with them, but can't see how to do them, so any help would be appreciated.
To put you in the picture, I have:
Invoice to Items (M:N). There are additional fields for the link, such as quantity and price. These fields are shown using the 'GridFieldEditableManyManyExtraColumns' extension.
I'm trying to do the following, without any luck:
1. On a line for the item view through the Invoice page, remove the 'Edit' button (so an item itself can't be edited through an invoice view)- Done with canEdit(). Although this didn't work the first time!
2. Also under Invoice, remove the 'Add Item' button to prevent new items being created this way, but allow linking to existing
3. Calculate a column, for example, there are two fields of quantity and price - can I show a line total?
4. On the invoice display, can I calculate the total of the invoice using a sum of point 3 for all 'child' items?
5. (Lastly) When a new item is linked to the invoice, set the value of 'Price' to the current price defined in 'Item'. The reason it's duplicated is because there's the actual price (in Item), and then there's the agreed price for the client (in the link table). Hope that makes sense!
I'm sorry there's a few points, but I've been trying to work it out over the last few days with no progress! Any questions, please throw them at me, and I'll try and answer them.
16 April 2013 at 4:06am
Probably you have to write your own FormField rather than using GridField.
I follow the example of the UserForms module to right my own Formfield to display information in the way i want.
|Go to Top|