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

help with tree view control

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

    help with tree view control

    I would like to start using the tree view control.
    I have watched the videos and worked with the examples and I can make that work OK.
    I can't figure out how to get dynamic data from linked mysql tables into any usable form.

    This is what I would like to have

    >Smith Bob - Customer parent level
    >>Jobs - Jobs Child level
    Job a
    Job b
    >>Work Orders - Work orders child level
    123
    124
    125
    >>Invoices - Invoices child level
    234
    235
    236
    >>Estimates - Estimates child level.
    345
    346
    347

    I can create the fixed Parent and child levels but I can't get the related child dynamic data levels to work.

    Is there a way to do this without looping through all of the tables to build this structure?
    I think that having to loop through the parent and child table would take too long to render.
    Last edited by frankbicknell; 01-29-2016, 09:58 AM.
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

    #2
    Re: help with tree view control

    The JSON and the tree control are pretty efficient. Part of the answer to your concern, as always, is how many branches and child records for each.

    How about a view as a single data source to produce the JSON?
    -Steve
    sigpic

    Comment


      #3
      Re: help with tree view control

      I have created several views with different configurations. I guess I just need to practice more because it is just not sinking in for me.

      Has anyone used the jTree jquery pugin? It looks like that may be easier to configure.
      Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

      Comment


        #4
        Re: help with tree view control

        OK I am getting somewhere now.

        I am looping through the tables and building the tree view control using xbasic. It is slow but it's a start.

        I am stuck now on figuring out how to include an onclick event that will open a ux to edit the appropriate record.

        this is what I have which opens the ux but to a blank record. I need to either set some session variable or arguments in the ux. Any ideas?
        Code:
        txt = txt + chr(9) + chr(9) + chr(9) +  rsc1.Data(1)+"{icon: 'myIcon1', onClick: '{dialog.object}.runAction(\'open_work_order_edit\')'}"+crlf()
        Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

        Comment


          #5
          Re: help with tree view control

          See if what I'm doing is of any help. I have Locations (L) and Animals (A). Each Group is a group of pools and animals, so the Medical Care group might have two pools and three animals currently residing. I found the button click event to be handy because it easily returns the value of the tree element and shows the UX I need for the user choice.

          Code:
          			
          while flag .and. rs.data("Group_Number") = Current_Group
          
          	' Sub-loop for all locations and pools in current group:
          	' Child:
          	ele_value = "G|" + rs.data("Group_Number") + "|" + rs.data("Type") + "|" + rs.data("Value")		'example: G|1|L|3
          	*concat(js, "	{" + crlf())
          	*concat(js, "		html: '" + rs.data("element_name") + "'," + crlf())
          	*concat(js, "		value: '" + ele_value + "'," + crlf())
          	if rs.data("Type") = "L"
          		*concat(js, "		icon: '" + img_location + "'," + crlf())
          	else
          		*concat(js, "		icon: '" + img_animal + "'," + crlf())
          	end if
          	*concat(js, "		onClick: function() {{dialog.object}.buttonClick('BUTTON_CLICKTREE'); }" + crlf())
          
          	flag = rs.nextRow()
          
          	' Another child in same group, or end of children for this group:
          	if flag = .t. .and. rs.data("Group_Number") = Current_Group
          		*concat(js, "	}," + crlf())
          	else
          		*concat(js, "	}" + crlf())
          		*concat(js, "]" + crlf())
          	end if
          end while
          -Steve
          sigpic

          Comment


            #6
            Re: help with tree view control

            Thanks Steve. I will experiment with your method... but for now

            I have muddled through and got this to work. (believe it or not).

            I am doing a callback in the onclick event.

            In the callback I can get the entire tree branch of the row I click in the e.V.R1.TREE1 pointer.
            Then I am taking the right 7 characters which is the work order number..
            followed by a sql_lookup to get the id of the work order to which I set a session variable...
            then in the action javascript that opens the edit ux I am using the 'Populate ux component with data from a table' set to the id session variable.
            The ux opens with the correct record.

            I have tried to submit the id which I am getting in the resultset for that child branch but I am getting an error that I cannot figure out when I include the parameters to submit the extra data in the callback. I can't seem to parse the javascript correctly. If I could do this I would not have to do a sql lookup in the callback.

            Doing it without being able to submit the id with the callback will get more complicated when I try to dress up the tree branch with more useful information Like work Order No and Date and Status, etc.

            There has got to be a better way. It certainly seems like all or most can be done client side.

            Here is the line in the xbasic from the treeview control that does the callback
            Code:
            txt = txt + chr(9) + chr(9) + chr(9) + chr(9) + rsc1.Data(1) + "{icon: 'myIcon1', onClick: '{dialog.object}.ajaxCallback(\'\',\'\',\'xbSetSessionVars\');'}" + crlf()
            here is the callback
            Code:
            function xbSetSessionVars as c (e as p)
            dim args as sql::arguments
            connection = "::name::???????"
            args.set("maWoNo",right(e.V.R1.TREE1,7))
            table = "???????"
            filter = "logno = :maWoNo"
            result_expression = "slid"
            session.snSlID = sql_lookup(connection,table,filter,result_expression,args)
            xbSetSessionVars = "{dialog.object}.runAction('open_work_order_edit');"
            end function
            Last edited by frankbicknell; 01-30-2016, 10:30 AM.
            Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

            Comment


              #7
              Re: help with tree view control

              I finally got the extra data parsed out so I don't have to do a sql lookup in the callback. I can dress up my branches in a view as long as I include the id in the resultset. It is actually working pretty smoothly.
              Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

              Comment


                #8
                Re: help with tree view control

                Anyone know how to programmatically open the first node?
                Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                Comment


                  #9
                  Re: help with tree view control

                  I don't know on this one. I'd like to be recording the last open/closed state of each node and bring it back to the user in exactly that same state. But it's not been a priority yet.
                  -Steve
                  sigpic

                  Comment


                    #10
                    Re: help with tree view control

                    After fiddling with this for a couple of days this is what I have come up with.

                    It is still awkward in that I have to refresh the entire tree if I add or delete a record, which closes all of the nodes and goes back to the beginning.

                    I have found in another thread that some have gotten jsTree plugin working. This may be more flexible as far as inserting and removing nodes without having to refresh the entire tree.

                    All in all I like the way it works for navigating through the records and my users like it too.

                    2016-02-01_13-42-51.png
                    Last edited by frankbicknell; 02-01-2016, 03:01 PM.
                    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                    Comment


                      #11
                      Re: help with tree view control

                      Yeah, the control is terrific once ya figure it out. I, too, would like to be able to add, move or remove a leaf without having to refresh the whole thing, esp. since I haven't found a way to maintain the open/closed state of each branch.
                      -Steve
                      sigpic

                      Comment


                        #12
                        Re: help with tree view control

                        If you use the genie you see that "expand" is used.
                        Closed is the default.


                        [
                        {
                        html: 'One',
                        expanded: true,
                        children: [
                        {
                        html: 'One Child'
                        }
                        ]
                        }
                        ]

                        Obviously you can manipulate the JSON with a list and save it to local storage. I have only played with the control for a day but I think it is relatively easy to build a dynamic list builder and allow customers to edit it.

                        Michael

                        Comment


                          #13
                          Re: help with tree view control

                          The Tree control is an Unordered List with it's main nodes being List Items. Each List Item can have an Unordered List of List Items, etc... which is where we get our expanding branches.

                          Alpha shows and hides the Items of a Branch by controlling the Display Style property. So... we can do the same.

                          This will expand the first branch of a tree...

                          Code:
                          var trNode = $('{dialog.ComponentName}.V.R1.TREE1.CONTROL.0').childNodes;
                          trNode[1].style.display = "block";
                          Going further, since you want to open/close a specific branch, then you'd know something about that branch and could search for it.
                          Having opened a specific branch, you could save the ids of those opened branches in order to come back later and re-open them automatically.

                          Comment


                            #14
                            Re: help with tree view control

                            Thank you David, That gives me some things to work with.

                            Michael I am building my tree using the a5_treeTextToJSON() function. I may be able to modify the json at some point. The tree view control is all new to me.
                            Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                            Comment


                              #15
                              Re: help with tree view control

                              Thanks again David.

                              I need to figure out the correct nomenclature for the tree object but here goes.
                              When I add or delete or make changes to the dynamic data the the tree is composed of I call a refresh function that re-opens the node that that I was working with. This makes this control near perfect.
                              Now I have to figure out how to re-select a 'leaf' whose data I have changed after I refresh the tree.
                              Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                              Comment

                              Working...
                              X