Jump to:

3373 Posts in 998 Topics by 712 members

Data Model Questions

SilverStripe Forums » Data Model Questions » SS3 along the lines of complextablefield

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 355 Views
  • voodoochile
    Avatar
    Community Member
    44 Posts

    SS3 along the lines of complextablefield Link to this post

    Hi all

    i have a dataobject that has several entries in it i want to create a form that lists each object along with an input field that on submission inserts each item with a seperate ID and a predetermined RelationID to another dataobject (i hope that make sense)

    Question one - is a form the way to go with this or is there something similar to complextablefield ?

    Question 2 - can this be done?

    I am looking for a start point or a direction to go in as i am not sure where to start with this, at present you have to add each object one at a time to build the list and it is slow and confusing for users idealy to have a list add the values all in one page is the goal?

    can anyone help?

    Thanks

  • zenmonkey
    Avatar
    Community Member
    524 Posts

    Re: SS3 along the lines of complextablefield Link to this post

    I think what you're looking for is the BulkEditingTools

    http://addons.silverstripe.org/add-ons/colymba/gridfield-bulk-editing-tools

    It should get you most of the way there, byond that you may need some logic in the onBeforeWrote to sort out your custom relations

  • voodoochile
    Avatar
    Community Member
    44 Posts

    Re: SS3 along the lines of complextablefield Link to this post

    Hi Zenmonkey

    Thanks for the Reply .. i will have a look at this, i'm not sure if it will fit the bill yet but looks like a good direction to start with.

  • voodoochile
    Avatar
    Community Member
    44 Posts

    Re: SS3 along the lines of complextablefield Link to this post

    ok .. so bulk editing tools is out as it does not support insert to has_many relations and i think what i'm trying to do goes beyond that anyway may not even be able to be done.

    currently i have been playing with doing it via a form but alas my php skills are not that great as yet.

    i have managed to build a form that creates a list of records from two tables and also gets some information into hidden fields all looks good ... Right or wrong this is just an html form, now i'm not to sure on the submission of the form result to the db.

    like i said this may be the completely wrong approach but i couldn't see how to get the information from the two tables into a single form within the framework. anyways the form needs to insert each tables list result to their respective new tables. these table are different to the tables the forms information comes from ( the reason for a form here is that the user is required to add a value before submitting the form)

    the form produces a list of products from one table and a second list of product from another table the user then adds a weight value to the required products and submits the form this then inserts each list into two new tables.

    doing this through the has_many relation in the cms each product has to be added one at a time (lots of clicks and things that can go bump from dfu mistakes) by presenting a form with all products listed (there will only ever be 30 products at most) the end user only has to go down the list and add the weight values and click submit (2-3 clicks at the most).

    if any one has any ideas or is there something i have missed would like to hear from you.

  • simon_w
    Avatar
    Forum Moderator
    467 Posts

    Re: SS3 along the lines of complextablefield Link to this post

    Have a look at the GridFieldRelationHandler module, which adds the relation management that the HasOne/HasMany/ManyManyComplexTableField classes provided.

  • voodoochile
    Avatar
    Community Member
    44 Posts

    Re: SS3 along the lines of complextablefield Link to this post

    Hi Simon

    have had a look thankyou for the reply and suggestion, GridFieldRelationHandler goes some way to solving the problem it would allow the user to select a group of products to be included in a new table if i have understood it correctly.

    where it falls short is the user would have to then still go into each product and add the weight value. unless this can be done from the summary fields?

    also could it create the list of products from 2 tables or would the adding have to be done seperately?

    to acheive what i am wanting to do i see a form as the best way at the moment. but it is clunky to do at best and i think a short term fix only until my php and silverstripe skills grow alot more.

  • voodoochile
    Avatar
    Community Member
    44 Posts

    Re: SS3 along the lines of complextablefield Link to this post

    i have mad a quick diagram of what i am doing hopefully it may help..

    Attached Files
    355 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.