We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Quote from: Bruno17 at Dec 04, 2013, 09:13 PM
    since you want to store the items as a json-string into the same table you will need a inputTVtype of 'migx' not 'migxdb' migxdb is trying to save its items into a table, each item, one db-record

    That makes sense.

    Now the issue is that after changing the input type, I am getting an error (Uncaught TypeError: Cannot read property 'name' of undefined ) when I try to save a new row in the specifications table. does the MIGX input type work with a migx config?
    • I have a new issue that is most likely an overlooked setting but I can't quite figure it out.

      I am nesting a migxdb grid that links to an "Images" table from the parent "Products" table. Essentially, I need the id from the parent product to be recorded into the IMage record (one-to-many from Products to Images). I can get the image grid to display, but it is showing ALL records in the image table. Furthermore, when I add an image, it doesn't record the current product record id into the Images table.

      Here is the Schema
      <?xml version="1.0" encoding="UTF-8"?>
      <model package="productcatalog" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
              <object class="Catalog" table="prod_catalog" extends="xPDOSimpleObject" >
      <field key="prodno" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
              <field key="description" dbtype="text" phptype="string" />
      <field key="classid" dbtype="text" phptype="string"/>
              <field key="prodname" dbtype="text" phptype="string" null="false" default="" />
              <field key="specifications" dbtype="text" phptype="json" null="false" default="" />
       <field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
              <field key="createdby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
              <field key="createdon" dbtype="datetime" phptype="datetime" null="false" />
              <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
                      <column key="id" collation="A" null="false" />
              </index>
              <aggregate alias="Creator" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign" />
      <aggregate alias="ProductCategory" class="ProdClass" local="classid" foreign="id" cardinality="one" owner="foreign" />
      <composite alias="Images" class="ProdImg" local="id" foreign="prodid" cardinality="many" owner="local"/>
              </object>
      	<object class="ProdImg" table="prod_images" extends="xPDOSimpleObject" >
              <field key="description" dbtype="text" phptype="string" />
              <field key="imgpath" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
      <field key="prodid" dbtype="int" precision="50" phptype="integer" null="false" default="0" />
              <field key="createdby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
              <field key="createdon" dbtype="datetime" phptype="datetime" null="false" />
              <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
                      <column key="id" collation="A" null="false" />
              </index>
              <aggregate alias="Creator" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign" />
      <aggregate alias="Product" class="Catalog" local="prodid" foreign="id" cardinality="one" owner="foreign" />
              </object>
      	<object class="ProdClass" table="prod_classes" extends="xPDOSimpleObject" >
              <field key="classname" dbtype="varchar" precision="255" phptype="string" />
      <field key="classimg" dbtype="text" phptype="string" />
              <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
                      <column key="id" collation="A" null="false" />
              </index>
              </object>
      </model>


      and here is the config for the parent (Catalog) CMP:
      {
        "formtabs":[
          {
            "MIGX_id":1,
            "caption":"General",
            "print_before_tabs":"0",
            "fields":[
              {
                "MIGX_id":1,
                "field":"prodno",
                "caption":"Product Number",
                "description":"",
                "description_is_code":"0",
                "inputTV":"",
                "inputTVtype":"text",
                "configs":"",
                "sourceFrom":"config",
                "sources":"[]",
                "inputOptionValues":"",
                "default":""
              },
              {
                "MIGX_id":2,
                "field":"prodname",
                "caption":"Product Name",
                "description":"",
                "description_is_code":"0",
                "inputTV":"",
                "inputTVtype":"text",
                "configs":"",
                "sourceFrom":"config",
                "sources":"[]",
                "inputOptionValues":"",
                "default":""
              },
              {
                "MIGX_id":4,
                "field":"classid",
                "caption":"Category",
                "description":"",
                "description_is_code":"0",
                "inputTV":"ProductCategories",
                "inputTVtype":"",
                "configs":"",
                "sourceFrom":"config",
                "sources":"[]",
                "inputOptionValues":"",
                "default":""
              },
              {
                "MIGX_id":3,
                "field":"description",
                "caption":"Description",
                "description":"",
                "description_is_code":"0",
                "inputTV":"",
                "inputTVtype":"richtext",
                "configs":"",
                "sourceFrom":"config",
                "sources":"[]",
                "inputOptionValues":"",
                "default":""
              }
            ]
          },
          {
            "MIGX_id":2,
            "caption":"Specifications",
            "print_before_tabs":"0",
            "fields":[
              {
                "MIGX_id":1,
                "field":"specifications",
                "caption":"Specifications",
                "description":"",
                "description_is_code":"0",
                "inputTV":"",
                "inputTVtype":"migx",
                "configs":"productspecs",
                "sourceFrom":"config",
                "sources":"[]",
                "inputOptionValues":"",
                "default":""
              }
            ]
          },
          {
            "MIGX_id":3,
            "caption":"Images",
            "print_before_tabs":"0",
            "fields":[
              {
                "MIGX_id":2,
                "field":"images",
                "caption":"",
                "description":"",
                "description_is_code":"0",
                "inputTV":"",
                "inputTVtype":"migxdb",
                "configs":"ProductImages",
                "sourceFrom":"config",
                "sources":"[]",
                "inputOptionValues":"",
                "default":""
              }
            ]
          }
        ],
        "contextmenus":"update||duplicate||activate||deactivate||recall_remove_delete||remove",
        "actionbuttons":"addItem||bulk",
        "columnbuttons":"",
        "filters":"[]",
        "extended":{
          "migx_add":"",
          "formcaption":"Manage the catalog products in the grid below",
          "update_win_title":"Product Catalog",
          "win_id":"productcatalog",
          "maxRecords":"",
          "addNewItemAt":"top",
          "multiple_formtabs":"",
          "extrahandlers":"",
          "packageName":"productcatalog",
          "classname":"Catalog",
          "task":"",
          "getlistsort":"",
          "getlistsortdir":"",
          "use_custom_prefix":"0",
          "prefix":"",
          "grid":"",
          "gridload_mode":1,
          "check_resid":1,
          "check_resid_TV":"",
          "join_alias":"",
          "has_jointable":"yes",
          "getlistwhere":"",
          "joins":[
            {
              "classname":"ProdClass",
              "alias":"ProductCategory",
              "on":"ProductCategory.id=classid"
            }
          ],
          "cmpmaincaption":"Product Catalog",
          "cmptabcaption":"Products",
          "cmptabdescription":"  ",
          "cmptabcontroller":"",
          "winbuttons":"",
          "onsubmitsuccess":"",
          "submitparams":""
        },
        "columns":[
          {
            "MIGX_id":1,
            "header":"ID",
            "dataIndex":"id",
            "width":"",
            "sortable":"false",
            "show_in_grid":"0",
            "renderer":"",
            "clickaction":"",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":"[]"
          },
          {
            "MIGX_id":2,
            "header":"Product No",
            "dataIndex":"prodno",
            "width":50,
            "sortable":true,
            "show_in_grid":1,
            "renderer":"",
            "clickaction":"selectFromGrid",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":"[]"
          },
          {
            "MIGX_id":3,
            "header":"Name",
            "dataIndex":"prodname",
            "width":500,
            "sortable":true,
            "show_in_grid":1,
            "renderer":"",
            "clickaction":"",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":"[]"
          },
          {
            "MIGX_id":4,
            "header":"Classification",
            "dataIndex":"ProductCategory_classname",
            "width":"",
            "sortable":true,
            "show_in_grid":1,
            "renderer":"",
            "clickaction":"",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":"[]"
          }
        ]
      }


      and for the Images (ProdImg) CMP
      {
        "formtabs":[
          {
            "MIGX_id":1,
            "caption":"Images",
            "print_before_tabs":"0",
            "fields":[
              {
                "MIGX_id":1,
                "field":"imgpath",
                "caption":"Image",
                "description":"",
                "description_is_code":"0",
                "inputTV":"",
                "inputTVtype":"image",
                "configs":"",
                "sourceFrom":"config",
                "sources":"[]",
                "inputOptionValues":"",
                "default":""
              }
            ]
          }
        ],
        "contextmenus":"update||recall_remove_delete||remove||remove_migx",
        "actionbuttons":"addItem||bulk",
        "columnbuttons":"update||deactivate||recall_remove_delete||remove||remove_migx",
        "filters":"[]",
        "extended":{
          "migx_add":"Add Image",
          "formcaption":"",
          "update_win_title":"",
          "win_id":"ProductImages",
          "maxRecords":"",
          "addNewItemAt":"top",
          "multiple_formtabs":"",
          "extrahandlers":"",
          "packageName":"productcatalog",
          "classname":"ProdImg",
          "task":"",
          "getlistsort":"",
          "getlistsortdir":"",
          "use_custom_prefix":"0",
          "prefix":"",
          "grid":"",
          "gridload_mode":2,
          "check_resid":1,
          "check_resid_TV":"",
          "join_alias":"",
          "has_jointable":"yes",
          "getlistwhere":"",
          "joins":[
            {
              "alias":"Product"
            }
          ],
          "cmpmaincaption":"",
          "cmptabcaption":"",
          "cmptabdescription":"",
          "cmptabcontroller":"",
          "winbuttons":"",
          "onsubmitsuccess":"",
          "submitparams":""
        },
        "columns":[
          {
            "MIGX_id":1,
            "header":"id",
            "dataIndex":"id",
            "width":"",
            "sortable":"false",
            "show_in_grid":"0",
            "renderer":"",
            "clickaction":"",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":"[]"
          },
          {
            "MIGX_id":2,
            "header":"Image",
            "dataIndex":"imgpath",
            "width":"",
            "sortable":"false",
            "show_in_grid":1,
            "renderer":"this.renderImage",
            "clickaction":"",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":"[]"
          },
          {
            "MIGX_id":3,
            "header":"prodid",
            "dataIndex":"prodid",
            "width":"",
            "sortable":"false",
            "show_in_grid":"0",
            "renderer":"",
            "clickaction":"",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":"[]"
          }
        ]
      }
      


      Where am I missing a configuration to pull the current product id and put it in the Images table, as well as how do I build the where clause to only display grid results for the currently loaded product?
      • solved my above nested-in-nested issue.

        It seems that Check Resource = yes only works if JoinAlias is used. Using a JSON value in Join field causes an error (resource_id can't be found).

          • 26503
          • 620 Posts
          Quote from: dvstudiosinc at Jan 05, 2014, 03:43 PM
          solved my above nested-in-nested issue.

          It seems that Check Resource = yes only works if JoinAlias is used. Using a JSON value in Join field causes an error (resource_id can't be found).


          Did you ever get this to work? I am trying to do almost exactly what you are trying to do (but with a project manager tool) and I am getting the same results. everything ~pretty much~ works, but when I click on the image tab it will load all the images in the image table, the id (mycase project_id, your case prodid) from the parent table is not being associated/pulled into the images table.
          I cut/pasted your schema & configs into my dev environment & got exactly the same problem.

          How did you resolve this?
            *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

            Sean Kimball CLP, CLS.
            Technical Director / Sr. Developer | BigBlock Studios
            ._______________________________________________.
            Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
            27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
            phone/fax: 905-426-5525
            • 46006
            • 17 Posts
            Hi Bruno,

            Are there any known limitations to the number of allowed nested MIGXdb tables?

            I've got 30+ MIGXdb tables, many with single nested MIGXdb tables (these have joins too). All are working great.

            When I try nesting a MIGXdb table inside an already nested MIGXdb table, I can successfully do the following:

            - Add new item
            - See correct columns (including joined aliases)

            ...but, I'm unable to edit an existing record.

            When I click [Edit] or right-click on a table row, the correct input fields are displayed, but none are populated by the correct data, i.e. they're blank and/or selectmenus do not have any option selected etc.

            After submiting [Done], the update process returns an error due to the 'object_id' not being set - however a field called 'co_id' (which I'm guessing should be the same as 'object_id') is set correctly. Here's the error (returned from 'processors/default/update.php'). I've simply added a JSON output of $scriptProperties to the error message:

            quip.thread_err_ns - missing object_id{"action":"mgr\/migxdb\/update","data":"{\"undefined\":\"\",\"contact\":\"- Please select -\",\"jobtitle\":\"- Please select -\",\"menuindex\":\"\",\"active\":\"\"}","configs":"xtra_event_program_contacts","resource_id":"0","co_id":"5","object_id":"","tv_id":"inp_404_inp_185_1_9_11","wctx":"mgr","tempParams":""}

            I would very much appreciate your help to resolve this. Meanwhile, I will keep debugging to see if I can fix this - if I do, I'll post a reply with the steps taken to fix it.

            Kind regards

            Jim

              • 4172
              • 5,888 Posts
              Is there a possibility to have a look into your manager for me?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 46006
                • 17 Posts
                Quote from: Bruno17 at Oct 04, 2018, 11:43 AM
                Is there a possibility to have a look into your manager for me?

                Hi Bruno,

                Thanks for the quick reply smiley

                I'm working locally, so the Manager isn't publically accessible.

                If you let me know exactly what files/configs you need from me, I can PM. That cool?

                Kind regards

                Jim
                  • 46006
                  • 17 Posts
                  Quote from: jpforsyth at Oct 04, 2018, 11:57 AM
                  Quote from: Bruno17 at Oct 04, 2018, 11:43 AM
                  Is there a possibility to have a look into your manager for me?

                  Hi Bruno,

                  Thanks for the quick reply smiley

                  I'm working locally, so the Manager isn't publically accessible.

                  If you let me know exactly what files/configs you need from me, I can PM. That cool?

                  Kind regards

                  Jim

                  Hi Bruno,

                  I previously stated that the error occured when trying to update a record, both after clicking [Edit] and/or right-clicking the table row.

                  Actually, this is incorrect. Sorry.

                  The error only occurs when right-clicking the table row.

                  If I render a column using this.renderRowActions, then clicking [Edit] will allow me to edit the record successfully.

                  Obviously a bug somewhere, but for the purpose of this project, I can continue without issue.

                  It would be great to understand/identify what's causing the right-click action to make things behave this way.

                  Kind regards

                  Jim
                    • 46006
                    • 17 Posts
                    Quote from: jpforsyth at Oct 04, 2018, 12:12 PM
                    Quote from: jpforsyth at Oct 04, 2018, 11:57 AM
                    Quote from: Bruno17 at Oct 04, 2018, 11:43 AM
                    Is there a possibility to have a look into your manager for me?

                    Hi Bruno,

                    Thanks for the quick reply smiley

                    I'm working locally, so the Manager isn't publically accessible.

                    If you let me know exactly what files/configs you need from me, I can PM. That cool?

                    Kind regards

                    Jim

                    Hi Bruno,

                    I previously stated that the error occured when trying to update a record, both after clicking [Edit] and/or right-clicking the table row.

                    Actually, this is incorrect. Sorry.

                    The error only occurs when right-clicking the table row.

                    If I render a column using this.renderRowActions, then clicking [Edit] will allow me to edit the record successfully.

                    Obviously a bug somewhere, but for the purpose of this project, I can continue without issue.

                    It would be great to understand/identify what's causing the right-click action to make things behave this way.

                    Kind regards

                    Jim

                    Hi Bruno,

                    Classic. Guess who forgot to add the ID column in their MIGXdb table?

                    Yep, me. I've now added this and everything works as expected.

                    Apologies for taking up your time.

                    Kind regards

                    Jim
                      • 4172
                      • 5,888 Posts
                      I'm glad, you got it sorted
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!