Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

MySql based list control hierarchical menus - children syntax needed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MySql based list control hierarchical menus - children syntax needed

    I converted the static JSON hierarchical list control menu example to a MySQL table. I have tried this numerous times....but the children code does not transfer over to the children field that is created. I have pasted variations of the code written for the static example into the CHILDREN table field but have not found the right combination to make it work when loaded from a table.

    Here is what is not working for me

    Code:
    children: [
                {
                    display: SubMenu1
                    action: sm1
                    icon: 
                }
                {
                    display: SubMenu2
                    action: sm2
                    icon: 
                }
                {
                    display: SubMenu3
                    action: sm3
                    icon: 
                }
               
            ]
    Any assistance would be appreciated....thanks!!

    #2
    Re: MySql based list control hierarchical menus - children syntax needed

    Bump....spent all weekend trying to make this work.....just cant get the right syntax in the sql children column...I can get the menu to recognize there is a child....but it does not display the child information or icon and the back button becomes a bit erratic

    Code:
    children: [{display: Menu One, action: action1,icon: cssIcon=fa fa-heart fa-1x}]
    Anyone have luck with this?
    Last edited by gregincolumbus; 04-17-2016, 09:26 PM.

    Comment


      #3
      Re: MySql based list control hierarchical menus - children syntax needed

      Both your JSON examples are very badly formatted and are wrong. You don't give a lot of info... Build etc., and no sample UX or table to work with, so all I can do is point out your JSON errors and hope that helps. In your first post, you're only showing children JSON... and it's quite wrong... you really should show a full example.

      In both cases, they are improperly formatted. You're missing commas, quotes and data. Here's what your JSON should look like... as shown in the hierarchical List examples for both Static and Table data in the Alpha videos:

      Code:
      [
          {
              "display": "Menu1",
      		 "icon":"",
      		 "children": [
                  {
                      "display": "SubMenu1",
                      "action": "sm1",
                      "icon": "cssIcon=fa fa-heart"
                  },
                  {
                      "display": "SubMenu2",
                      "action": "sm2",
                      "icon": "cssIcon=fa fa-heart"
                  },
                  {
                      "display": "SubMenu3",
                      "action": "sm3",
                      "icon": ""
                  }
                 
              ]
          }
      ]
      or... just showing partial JSON for a child as you have...

      Code:
      children: [{"display": "Menu One", "action": "action1", "icon": "cssIcon=fa fa-heart fa-1x"}]
      I'm assuming you have the Genie code running for your List to interpret Nested data and that, for the SQL Table you're using, you're employing the List Custom data source and have properly coded that.

      I've run a Nested List from both Static data and SQL Table successfully... no issues.

      Comment


        #4
        Re: MySql based list control hierarchical menus - children syntax needed

        Hi David...thank you for trying to help me. I am a JSON newbie but I am trying to learn. Here is more information

        I am using the official release of v4 with a MySQL backend. Here is what I am attempting to do:

        1. I created a UX from the splitview with hierarchical menu template
        2 That generates the following static code for the menu

        Code:
        [
            {
                "display": "Menu A",
                "icon": "cssIcon=fa fa-delicious fa-2x {color: #8286d8;}",
                "children": [
                    {
                        "display": "Menu One",
                        "action": "action1",
                        "icon": "cssIcon=fa fa-heart fa-1x"
                    },
                    {
                        "display": "Menu Two",
                        "action": "action2",
                        "icon": "cssIcon=fa fa-music fa-1x"
                    }
                ]
            },
            {
                "display": "Menu B",
                "icon": "cssIcon=fa fa-trophy fa-2x {color: #f86c6c;}",
                "children": [
                    {
                        "display": "Menu Three",
                        "action": "action3",
                        "icon": "cssIcon=fa fa-search fa-1x"
                    },
                    {
                        "display": "Menu Four",
                        "action": "action4",
                        "icon": "cssIcon=fa fa-envelope-o fa-1x"
                    }
                ]
            },
            {
                "display": "Menu C",
                "icon": "cssIcon=fa fa-building-o fa-2x {color: #e7ec87;}",
                "children": [
                    {
                        "display": "Menu Five",
                        "action": "action5",
                        "icon": "cssIcon=fa fa-star-o fa-1x"
                    },
                    {
                        "display": "Menu Six",
                        "action": "action6",
                        "icon": "cssIcon=fa fa-heart fa-1x"
                    }
                ]
            },
            {
                "display": "Menu D",
                "icon": "cssIcon=fa fa-calendar fa-2x {color: #90e491;}",
                "children": [
                    {
                        "display": "Menu Seven",
                        "action": "action7",
                        "icon": "cssIcon=fa fa-user fa-1x"
                    },
                    {
                        "display": "Menu Eight",
                        "action": "action8",
                        "icon": "cssIcon=fa fa-film fa-1x"
                    },
            {
                "display": "Menu E",
                "icon": "cssIcon=fa fa-bullhorn fa-2x {color: #db75cf;}",
                "children": [
                    {
                        "display": "Menu Nine",
                        "action": "action9",
                        "icon": "cssIcon=fa fa-pencil fa-1x"
                    },
                    {
                        "display": "Menu Ten",
                        "action": "action10",
                        "icon": "cssIcon=fa fa-map-marker fa-1x"
                    }
                ]
            }
                ]
            }
        ]
        That works fine.

        At the bottom of the list builder is an option to convert list data source to SQL. I chose that option and it created a table with the following fields

        display, icon, children

        It created 4 records to match the static data and populated the DISPLAY field with
        Code:
        Menu A
        It populated the ICON field with

        Code:
        cssIcon=fa fa-delicious fa-2x {color: #8286d8;}
        Note that the other normal JSON formatting is not included......when I check the JSON list data I get this:


        Code:
        A5DataArrayToObject(['display','icon','children','__primaryKey'],[ [ "Menu A" , "cssIcon=fa fa-delicious fa-2x {color: #8286d8;}" , "" , "Menu A" ]
        , [ "Menu B" , "cssIcon=fa fa-trophy fa-2x {color: #f86c6c;}" , "" , "Menu B" ]
        , [ "Menu C" , "cssIcon=fa fa-building-o fa-2x {color: #e7ec87;}" , "" , "Menu C" ]
        , [ "Menu D" , "cssIcon=fa fa-calendar fa-2x {color: #90e491;}" , "" , "Menu D" ]
         ])
        That works fine....but only has the top level since no data was written to the CHILDREN field.

        Note that the list now has JSON formatting.

        When I add properly formatted JSON code into the CHILDREN field.....and look at the list data....it is this:

        Code:
        A5DataArrayToObject(['display','icon','children','__primaryKey'],[ [ "Menu A" , "cssIcon=fa fa-delicious fa-2x {color: #8286d8;}" , "\"children\": [\n            {\n                \"display\": \"Menu Seven\",\n                \"action\": \"action7\",\n                \"icon\": \"cssIcon=fa fa-user fa-1x\"\n            },\n            {\n                \"display\": \"Menu Eight\",\n                \"action\": \"action8\",\n                \"icon\": \"cssIcon=fa fa-film fa-1x\"\n            }," , "Menu A" ]
        , [ "Menu B" , "cssIcon=fa fa-trophy fa-2x {color: #f86c6c;}" , "" , "Menu B" ]
        , [ "Menu C" , "cssIcon=fa fa-building-o fa-2x {color: #e7ec87;}" , "" , "Menu C" ]
        , [ "Menu D" , "cssIcon=fa fa-calendar fa-2x {color: #90e491;}" , "" , "Menu D" ]
         ])
        Obviously that is not correct. While it is escaping things....the format is not working to display the menu

        If I remove the quotes and line breaks...I get this:

        Code:
        A5DataArrayToObject(['display','icon','children','__primaryKey'],[ [ "Menu A" , "cssIcon=fa fa-delicious fa-2x {color: #8286d8;}" , "children: [{display: Menu Seven,action: action1,icon: cssIcon=fa fa-user fa-1x }]" , "Menu A" ]
        , [ "Menu B" , "cssIcon=fa fa-trophy fa-2x {color: #f86c6c;}" , "" , "Menu B" ]
        , [ "Menu C" , "cssIcon=fa fa-building-o fa-2x {color: #e7ec87;}" , "" , "Menu C" ]
        , [ "Menu D" , "cssIcon=fa fa-calendar fa-2x {color: #90e491;}" , "" , "Menu D" ]
         ])
        Closer....but the quote after CHILDREN has been moved to the end of the array bracket before the primary key space....instead of closing off CHILDREN and the array bracket may not be in the right spot (before the primary key space (but not sure since I am a newbie)

        So I have been trying to play with the data entered into the CHILDREN field of my db table that results in valid JSON code when viewing the list data.

        Hopefully that gives more details....again....thank you for your efforts at helping a newbie!

        Comment


          #5
          Re: MySql based list control hierarchical menus - children syntax needed

          Hi Greg,

          You can't remove quotes and lines break and end up with anything useful... it doesn't work that way.

          I've confirmed that the "Convert static List data to SQL" does not do anything with hierarchical data. It intended for flat static data.

          Further, the XBasic function a5 Helper function " a5_sqlToJSONTree" and the XBasic JSON function "a5_XbasicTreeToJSONTree" are inteded for simple hierarchical JSON... not multi-field complex JSON. IOW, no Icon fields for parents or children... it's strictly parent/children... nothing else.

          You're going to have to build you're own JSON from your table. Process a parent, building JSON for all that Parent's columns. Then, process the children for that Parent, grandchildren, etc. At least you have a good model starting with correct Static JSON.

          It's a bit of work. I've done it before for the DHTMLX TreeGrid Control - a beautiful control that mashes a Tree with a Grid with hierarchical data... amazing. Working out an unknown number of children and processing into JSON was tough. It always felt like a "Who's on First" scenario.

          Comment

          Working...
          X