We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49499
    • 48 Posts
    I'm trying to manage endorsements in a grid, via migxdb. I am able to see the grid and add/edit endorsements from the CMP. However, from the TV, the grid loads the column headings, but no entries. There are no dbfilters in place. The odd thing is that I can add endorsements and they show up in the database properly, however I cannot see them after they are added.

    Here were my steps:

    Created a package called 'endorsements' with the Custom Prefix 'modx_custom_'.
    Created schema. Parsed Schema. Created Table. All successful.

    Here is my schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <model package="endorsements" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
    	<object class="Endorsement" table="endorsements" extends="xPDOSimpleObject">
    		<field key="minister_id" dbtype="int" precision="11" attributes="unsigned" phptype="integer" null="false" default="" />
    		<field key="name" dbtype="varchar" precision="250" phptype="string" null="false" default="" />
    		<field key="title" dbtype="varchar" precision="250" phptype="string" null="false" default="" />
    		<field key="ministry" dbtype="varchar" precision="250" phptype="string" null="false" default="" />
    		<field key="location" dbtype="varchar" precision="250" phptype="string" null="false" default="" />
    		<field key="url" dbtype="varchar" precision="250" phptype="string" null="false" default="" />
    		<field key="image" dbtype="varchar" precision="250" phptype="string" null="false" default="" />
    		<field key="endorsement" dbtype="text" phptype="string" null="false" default=""/>
    		<field key="pos" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
    		<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
    		<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
    		<index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
    			<column key="id" collation="A" null="false" />
    		</index>
    	</object>
    </model>


    I set up my Formtabs and Columns to match my field names in the DB.

    Under the MIGXdb-settings, I am using the following (matching my schema):
    Package: endorsements
    Classname: Endorsement
    Custom Prefix: modx_custom_

    Here is my migxdb configuration:
    {
      "formtabs":[
        {
          "MIGX_id":49,
          "caption":"Endorsement",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":204,
              "field":"name",
              "caption":"Name",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":1
            },
            {
              "MIGX_id":205,
              "field":"title",
              "caption":"Title",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":2
            },
            {
              "MIGX_id":206,
              "field":"ministry",
              "caption":"Ministry",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":3
            },
            {
              "MIGX_id":207,
              "field":"location",
              "caption":"Location",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":4
            },
            {
              "MIGX_id":209,
              "field":"url",
              "caption":"URL",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"url",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":5
            },
            {
              "MIGX_id":208,
              "field":"endorsement",
              "caption":"Endorsement",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"richtext",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":6
            },
            {
              "MIGX_id":210,
              "field":"image",
              "caption":"Image",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"image",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":[
                {
                  "MIGX_id":1,
                  "context":"web",
                  "sourceid":17
                },
                {
                  "MIGX_id":2,
                  "context":"mgr",
                  "sourceid":17
                }
              ],
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":7
            },
            {
              "MIGX_id":203,
              "field":"minister_id",
              "caption":"Minister ID",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":8
            }
          ],
          "pos":1
        }
      ],
      "contextmenus":"update||duplicate||publish||unpublish",
      "actionbuttons":"addItem||bulk",
      "columnbuttons":"update||duplicate||publish||unpublish",
      "filters":"",
      "extended":{
        "migx_add":"Add Endorsement",
        "disable_add_item":"",
        "add_items_directly":"",
        "formcaption":"Add \/ Edit Endorsement",
        "update_win_title":"Add \/ Edit Endorsement",
        "win_id":"endorsements",
        "maxRecords":"",
        "addNewItemAt":"bottom",
        "multiple_formtabs":"",
        "multiple_formtabs_label":"",
        "multiple_formtabs_field":"",
        "multiple_formtabs_optionstext":"",
        "multiple_formtabs_optionsvalue":"",
        "actionbuttonsperrow":2,
        "winbuttonslist":"",
        "extrahandlers":"this.handlePositionSelector",
        "filtersperrow":4,
        "packageName":"endorsements",
        "classname":"Endorsement",
        "task":"",
        "getlistsort":"pos",
        "getlistsortdir":"ASC",
        "sortconfig":"",
        "gridpagesize":"",
        "use_custom_prefix":1,
        "prefix":"modx_custom_",
        "grid":"",
        "gridload_mode":1,
        "check_resid":1,
        "check_resid_TV":"",
        "join_alias":"",
        "has_jointable":"yes",
        "getlistwhere":"",
        "joins":"",
        "cmpmaincaption":"Endorsement Manager",
        "cmptabcaption":"Endorsements",
        "cmptabdescription":"",
        "cmptabcontroller":"",
        "winbuttons":"",
        "onsubmitsuccess":"",
        "submitparams":""
      },
      "columns":[
        {
          "MIGX_id":1,
          "header":"ID",
          "dataIndex":"id",
          "width":15,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":2,
          "header":"Name",
          "dataIndex":"name",
          "width":45,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":3,
          "header":"Endorsement",
          "dataIndex":"endorsement",
          "width":50,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":4,
          "header":"Sort",
          "dataIndex":"pos",
          "width":15,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"this.renderPositionSelector",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":5,
          "header":"Published",
          "dataIndex":"published",
          "width":15,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"this.renderClickCrossTick",
          "clickaction":"switchOption",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        }
      ]
    }


    I then created a template variable called 'endorsement_manager'. It is type 'migxdb' with a configuration 'endorsements'. The columns load correctly, but no entries are populated.

    However, when I made a menu link to the CMP, the columns and entries are populated correctly.

    Does anyone have any suggestions?

    This question has been answered by Bruno17. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      try to change this MIGXdb-setting:

      "check_resid":1,


      should be off (0)

      otherwise it tries to filter items with a resource_id of the current resource.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 49499
        • 48 Posts
        Quote from: Bruno17 at Jun 17, 2015, 11:43 PM
        try to change this MIGXdb-setting:

        "check_resid":1,


        should be off (0)

        otherwise it tries to filter items with a resource_id of the current resource.

        Works like a charm.

        Thank you, Bruno! Helpful as always!