Editing one to many relationships in same page
Archived from the Xataface Users forum.
tomhousley — Wed Aug 05, 2009 12:50 am
Hello,
I have two tables, tbl_organisations & tbl_individual, these have a relationship defined in relationships.ini as:
- Code: Select all
[People in this organisation] __sql__ = "SELECT * FROM tbl_individual WHERE org_id='$org_id'"
When editing a record from tbl_organisations, I would like to be able to have the list of individuals in an editable table within that edit form.
Below is a screenshot from SugarCRM, which has an example of what I am trying to emulate, though with table of child records editable.
Many thanks, Tom
shannah — Wed Aug 05, 2009 12:07 pm
Well.. there’s nothing that is exactly like this right now, however there are some similar things and it wouldn’t be hard to do exactly this with a little bit of development.
Similar things:
-
Using the grid widget in the edit form.
-
Filling a slot on the related record list (can’t think of the slot right now - maybe before_related_records_list? — enter debug mode for a list of available slots).
Something like this could quite easily be developed. Add this to the issue tracker and I’ll see if I can get to it for an upcoming release.
-Steve
tomhousley — Wed Aug 05, 2009 1:01 pm
Hi Steve,
Thank you for the suggestion. I have tried the widget:type=grid, the contents of which are:
- Code: Select all
[Individuals] widget:label = "Individuals" transient=1 relationship=People in this organisation widget:type=grid widget:columns="ind_firstname,ind_lastname,ind_tel"
My relationships.ini looks like this:
- Code: Select all
[People in this organisation] __sql__ = "SELECT * FROM tbl_individual WHERE org_id='$org_id'"
The rows of individuals display fine, but there is no way to delete a record, ie. no icon showing.
It looks like your image (shown below) on the wiki but without the red cross and the sort order thing.
Many thanks, Tom
shannah — Wed Aug 05, 2009 1:06 pm
This is likely a permissions issue. Check the permissions on your relationship to ensure that the remove related record and delete related record permissions are allowed.
shannah — Wed Aug 05, 2009 1:06 pm
Another thing is that your relationship name shouldn’t have spaces in it. If you want to name it you can provide the action:label attribute.
-Steve
tomhousley — Thu Aug 06, 2009 1:20 am
Hi Steve,
That’s perfect. Thank you very much.
I have added details on the grid to the wiki: