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

Viewbox as a "list" - how to sort and search

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

    Viewbox as a "list" - how to sort and search

    Hello all (and likely peteconway as he is the resident Viewbox expert)

    I am playing with/learning Viewboxes and am attempting to replace some list controls in a UX with a viewbox to improve speed and just improve my overall knowledge.

    Is there a way to emulate list behaviors such as Sorting by clicking a column, search/filter "list". These two functions would seem to be the only things keeping my UX from running exactly as before when it had lists.

    Any help, advice, instruction would be greatly appreciated!

    #2
    I haven't tried sorting, simply because the search does so good for me.
    Feel free to check out https://z5.youshould-seethis.com/vbproject/testdl.a5w.

    Clicking the Get Started button will take you to a list of youtube videos posted by Alpha Anywhere and a few people helping with various
    other development topics. The search feature is fast, but that's because it does not make a callback to the server.

    If that's at least part of the process you're looking for, I will make it available to you(I have to go back and figure it out as I've
    been stumped for a few weeks by the downloading from AWS S3 not working as expected/desired).
    Gregg
    https://paiza.io is a great site to test and share sql code

    Comment


      #3
      Thanks Gregg, I'd say the search is definitely the most important part. Sorting is just a "would be nice" but if I could get a search working it'd be gold.

      Comment


        #4
        Are your wanting to search Static Data (a VB populated on an initial load) or Dynamic (refreshed data base) data (preferred)?
        Pete
        Insanity: doing the same thing over and over again and expecting different results.
        Albert Einstein, (attributed)
        US (German-born) physicist (1879 - 1955)

        Comment


          #5
          I think in most cases static would suffice, as the typical use case would be looking up a record previous entered to then open an edit panel with a "detail view". Happy to learn either method though.

          Comment


            #6
            This is my code to search a viewbox.


            Code:
            function populateVB(datacontrol,vbcontrol,nextp){
            //debugger;
            
            var showme = {dialog.object}.getValue(datacontrol.toUpperCase());
            //alert(showme);
            var vbObj = {dialog.object}.getControl(vbcontrol);
            var mhcbOBJ = {dialog.object}.getControl('CONTROLBAR_8')
            var vbData = JSON.parse('[' + {dialog.object}.getValue(datacontrol) + ']');
            vbObj.populate(vbData);
            vbObj.setState({'mastercount': vbData.length});
            {dialog.object}.setValue('fullcount',vbData.length);
            {dialog.object}.stateInfo['allvideos'] = vbData.length;
            //vbObj.refresh();
            //$svs('mastercount',vbData.length);
            mhcbOBJ.update('vidcount',vbData.length);
            {dialog.object}.panelSetActive(nextp,false);
            }
            Code:
            function jssearch(searchcontrol,whattosearch){
            //debugger;
            var rawterm = {dialog.object}.getValue('searchbox');
            var rawsource = {dialog.object}.getValue('searchchan');
            var filtersource = rawsource.length;
            var searchObj
            var searchterm = rawterm.toLowerCase();
            //alert(searchterm);
            var tracker = 0;
            
            if(typeof(whattosearch) == 'string'){
            searchObj = JSON.parse ('[' + {dialog.object}.getValue(whattosearch) + ']');
            }
            let searchitems = [];
            
            if(filtersource < 1){
            searchObj.forEach(s => {if(s.videotitle.toLowerCase().indexOf(searchterm) != -1 || s.videodescription.toLowerCase().indexOf(searchterm) != -1 || s.keywords.toLowerCase().indexOf(searchterm) != -1 )
            
            searchitems.push(s)
            })
            } else {
            searchObj.forEach(s => {if(s.channeltitle.toLowerCase().indexOf(rawsource) != -1 && (s.videotitle.toLowerCase().indexOf(searchterm) != -1 || s.videodescription.toLowerCase().indexOf(searchterm) != -1 || s.keywords.toLowerCase().indexOf(searchterm) != -1 ))
            
            searchitems.push(s)
            })
            }
            //
            
            //
            {dialog.object}.setValue('filteredcount',searchitems.length);
            {dialog.object}.setValue('activefilter',searchterm);
            var output = {dialog.Object}.getControl('vbSearchResults');
            var searchCB = {dialog.Object}.getControl('RESULTS_HEADER_CB');
            searchCB.update('filteredcount',searchitems.length);
            searchCB.update('searchterm',searchterm);
            output.populate(searchitems);
            {dialog.object}.stateInfo['filteredvideos'] = vbData.length;
            output.refresh();
            }
            Gregg
            https://paiza.io is a great site to test and share sql code

            Comment


              #7
              Well that's a lot of code ..

              This is my solution for the Viewbox search..

              function setVBStateVariable(){

              // Set a viewboxs state variable from the UX's clientside values from a UX control (or a UX state variable) to be visible in the Viewbox as a filter, a conditional argument, or something to display.


              var vb = {dialog.object}.getControl('aprescott'); // get the Viewboxame and assign to vb
              var cv = {dialog.object}.stateInfo['controlValue']; // get the UX controls value and assign to cv
              var tempObj = cv ;

              vb.setState({'filter': tempObj}); // add or update the state variable in the viewbox vb.setState({'filter': tempObj});
              vb.refresh();
              }
              How to Search - let me know if this (video) is what you are trying to do and I'll do the how to and sample component. The sample is ideal for static or database population methods, where callbacks are not required for the search like when off-line..

              https://www.screencast.com/t/vHUkOGHLjr
              Insanity: doing the same thing over and over again and expecting different results.
              Albert Einstein, (attributed)
              US (German-born) physicist (1879 - 1955)

              Comment


                #8
                Hi Peter

                How does this code filter the view box?

                Comment


                  #9
                  Well its late in the night here so I will go over it now sow it's clear..no need for a video: The reason I didn't do anymore on this is the person who wanted help - didn't reply.
                  Set a viewboxs state variable from the UX's clientside values from a UX control (or a UX state variable) to be visible in the Viewbox as a filter, a conditional argument, or something to display.


                  var vb = {dialog.object}.getControl('aprescott'); // get the Viewboxame and assign to vb this is the viewbox
                  var cv = {dialog.object}.stateInfo['controlValue']; // get the UX controls value and assign to cv this is a UX state variable in the UX that has the search info
                  var tempObj = cv ; remember this is a pointer to the viewbox we are wanting to filter

                  vb.setState({'filter': tempObj}); // add or update the state variable in the viewbox vb.setState({'filter': tempObj}); this line inserts the search info into the viewbox as a viewbox state variable.
                  vb.refresh(); now I have refreshed the viewbox with to added a control- it has a value like Smith or UK.

                  IN the Viewbox layout you can see we now have access to the search info as it's in the state variable I inserted called filter

                  Once it's inserted the viewbox template can use it like below in a if statement, the possibilities are endless, keeping in-mind you can have as many viewbox state vars and multiple layouts as you want.

                  The search button does this..


                  {dialog.Object}.setValue('VideoCount',0);
                  {dialog.object}.stateInfo['controlValue'] = this.data.SearchItem;
                  setVBStateVariable();

                  The clear button does this..
                  {dialog.Object}.setValue('VideoCount',0);
                  var cbObj = {dialog.object}.getControl('CONTROLBAR_APRESCOTT')
                  cbObj.update('SearchItem','');
                  {dialog.object}.stateInfo['controlValue'] = this.data.SearchItem;
                  setVBStateVariable();



                  {*root}
                  {*header}
                  <div class="[theme:listBox.base.columnLayout.header.className]">
                  <div style="display: table; width: 100%;">
                  <div style="display: table-cell; width: 40%; vertical-align: left;">
                  <div class="[theme:listBox.base.columnLayout.header.item.className]">Contact Name</div>
                  </div>
                  <div style="display: table-cell; width: 20%; vertical-align: left;">
                  <div class="[theme:listBox.base.columnLayout.header.item.className]">Company Name</div>
                  </div>
                  <div style="display: table-cell; width: 20%; vertical-align: left;">
                  <div class="[theme:listBox.base.columnLayout.header.item.className]">City</div>
                  </div>
                  <div style="display: table-cell; width: 20%; vertical-align: left; ">
                  <div class="[theme:listBox.base.columnLayout.header.item.className]">Country</div>
                  </div>
                  </div>
                  </div>
                  {/*header}
                  {*if [temp].state.filter == 'All' || Country.toLowerCase().includes([temp].state.filter) || ContactName.toLowerCase().includes([temp].state.filter.toLowerCase()) || CompanyName.includes([temp].state.filter) || City.toLowerCase().includes([temp].state.filter.toLowerCase())}
                  <div class="[theme:listBox.base.item.className]" a5-item="row" a5-value="{[count]}">
                  <div style="display: table; width: 100%;">
                  <div style="display: table-cell; width: 40%; vertical-align: left;">
                  <div class="[theme:listBox.base.columnLayout.header.item.className]">{ContactName}</div>
                  </div>
                  <div style="display: table-cell; width: 20%; vertical-align: left;">
                  <div class="[theme:listBox.base.columnLayout.header.item.className]">{CompanyName}</div>
                  </div>
                  <div style="display: table-cell; width: 20%; vertical-align: left; ">
                  <div class="[theme:listBox.base.columnLayout.header.item.className]">{City}</div>
                  </div>
                  <div style="display: table-cell; width: 20%; vertical-align: left;">
                  <div class="[theme:listBox.base.columnLayout.header.item.className]">{Country}</div>
                  </div>
                  </div>
                  </div>
                  {*endif}
                  {/*root}
                  And that's it - I've added the component so you expand on what I've presented. The viewbox is by far the best way to produce high quality, low overhead, xbasic and Javascript Action -free applications in your builds.
                  Also I'm available for selected consults and mentoring if any wants to learn. Just PM me.

                  Pete














                  Attached Files
                  Insanity: doing the same thing over and over again and expecting different results.
                  Albert Einstein, (attributed)
                  US (German-born) physicist (1879 - 1955)

                  Comment


                    #10
                    Thanks for the explanation.

                    Comment


                      #11
                      Cheers
                      Insanity: doing the same thing over and over again and expecting different results.
                      Albert Einstein, (attributed)
                      US (German-born) physicist (1879 - 1955)

                      Comment


                        #12
                        Sorry everyone - I got called into a week of jury duty and now am trying to get my head above water after missing a week of work. Going to take a look at everything suggested here and give it a whirl. Thanks to everyone for their suggestions!

                        Comment


                          #13
                          Cheers
                          Insanity: doing the same thing over and over again and expecting different results.
                          Albert Einstein, (attributed)
                          US (German-born) physicist (1879 - 1955)

                          Comment


                            #14
                            peteconway - works like a dream. Perfect. Thanks so much.

                            Comment


                              #15
                              Good. I'm glad you have certainly had your battles.
                              Insanity: doing the same thing over and over again and expecting different results.
                              Albert Einstein, (attributed)
                              US (German-born) physicist (1879 - 1955)

                              Comment

                              Working...
                              X