Using a nested migx grid/list as a input, is it possible?

@bruno17 || @halftrainedharry,I was wondering if you know a way to use a nested migxDb list. Instead of adding or removing records, the idea is to use a grid to select a record. This way, you could have a neat table with database rows. Then, you can select one or more rows to connect to the record you are creating or editing, instead of using a dropdown.

I know how to create a custom action button, but how can you make it save this state in the parent record? ? Also, when opening the parent row, how do you ensure that the chosen items are still selected in the child list?

I’m not sure I understand your question.

Do you mean something as described in this topic from the old forum?

What I mean is this: I have a schema like this:

<?xml version="1.0" encoding="UTF-8"?>

<model package="goodhabitz" baseClass="xPDOObject" platform="mysql" defaultEngine="InnoDB" phpdoc-package="" phpdoc-subpackage="" version="1.1">

    <object class="goodhabitzTeams" table="goodhabitz_teams" extends="xPDOSimpleObject">
        <field key="name" dbtype="varchar" phptype="string" precision="100" null="false" default="" index="index"/>
        <field key="description" dbtype="text" phptype="string" null="false" default="" />
        <field key="pos" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />

		<index alias="name" name="name" primary="false" unique="false" type="BTREE">
			<column key="name" length="" collation="A" null="false" />
		</index>  
        <index alias="pos" name="pos" primary="false" unique="false" type="BTREE">
            <column key="pos" length="" collation="A" null="false" />
        </index>

        <composite alias="goodhabitzTeamUsers" class="goodhabitzTeamUsers" local="id" foreign="team_id" cardinality="many" owner="local"/>

    </object>

    <object class="goodhabitzTeamUsers" table="goodhabitz_team_users" extends="xPDOSimpleObject">
        <field key="user_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
        <field key="team_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />

        <index alias="user_id" name="user_id" primary="false" unique="false" type="BTREE">
            <column key="user_id" length="" collation="A" null="false" />
        </index>

        <index alias="team_id" name="team_id" primary="false" unique="false" type="BTREE">
            <column key="team_id" length="" collation="A" null="false" />
        </index>

        <aggregate alias="goodhabitzTeams" class="goodhabitzTeams" local="team_id" foreign="id" cardinality="one" owner="foreign"/>
        <aggregate alias="User" class="modUser" local="user_id" foreign="id" cardinality="one" owner="foreign" />

    </object>

    <object class="goodhabitzUserCourses" table="goodhabitz_user_courses" extends="xPDOSimpleObject">
        <field key="user_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
        <field key="CourseId" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />

        <index alias="user_id" name="user_id" primary="false" unique="false" type="BTREE">
            <column key="user_id" length="" collation="A" null="false" />
        </index>

        <index alias="CourseId" name="CourseId" primary="false" unique="false" type="BTREE">
            <column key="CourseId" length="" collation="A" null="false" />
        </index>

        <aggregate alias="goodhabitzCourses" class="goodhabitzCourses" local="CourseId" foreign="CourseId" cardinality="one" owner="foreign"/>
        <aggregate alias="goodhabitzTeamUsers" class="goodhabitzTeamUsers" local="user_id" foreign="user_id" cardinality="one" owner="foreign" />
    </object>

    <object class="goodhabitzCourses" table="goodhabitz_courses" extends="xPDOSimpleObject">
        <field key="CourseId" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />
        <field key="CourseCode" dbtype="varchar" precision="255" phptype="string" null="true" />
        <field key="CourseTitle" dbtype="varchar" precision="255" phptype="string" null="true" />
        <field key="ImageUrlLandscape" dbtype="varchar" precision="255" phptype="string" null="true" />
        <field key="Duration" dbtype="int" precision="5" phptype="int" null="true" />
        <field key="Description" dbtype="text" phptype="string" null="true" />
        <field key="Category" dbtype="varchar" precision="255" phptype="string" null="true" />
        <field key="CourseCode" dbtype="varchar" precision="255" phptype="string" null="true" />

        <index alias="CourseId" name="CourseId" primary="false" unique="true" type="BTREE">
            <column key="CourseId" length="" collation="A" null="false" />
        </index>

        <composite alias="goodhabitzUserCourses" class="goodhabitzUserCourses" local="CourseId" foreign="CourseId" cardinality="many" owner="local"/>

    </object>
</model>

the I have one config that reads and writes goodhabitzUserCourses, Thats a CMP that somone could edit if needed.

Then I have a CMP to create teams, in that config I have a nested config to select users per team, Then I have another nested in the nested, to assign courses to a user. There I now have a @SELECT binding to the goodhabitzUserCourses table that generates a listbox, but what if we could skip that step and load all the cources as a grid in the user config. then you could search a course and select the course using the checkbox.

in the image above, if we could replace the select course nested config wit a list of all courses in the same format/grid then just check the checkbox for the cources you like to connect to this user.

I did somthing like this before but never on a nested level:

this list is loaded by a custom config.

then you select rows and press the action button, that will fire a custom processor.and create chunks for configs with all placeholders needed in the chunks.

So something like that but then it should save the cources to the goodhabitzUserCourses table and when loading this user, check those boxes.

I did something like that. Let me search for that (if not @halftrainedharry has allready found a solution)

here is an example config, if that helps:

In this case, I can select members (mvMember), which are allowed to use a specific boat (fbuchBoot). Ase soon, as the checkbox in the column is checked, an item in the table with class fbuchBootAllowedNames is created.

You can find all relevant processors, chunks, snippets, the schema etc. in that repo.


1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.