Subscribe: RSS
  • 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).

        • 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