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

missing alphabet search bar for list

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

    missing alphabet search bar for list

    I am in the process of saying goodbye to grids. Hello to lists and repeating sections. One of the things I will miss the most is the alphabet search bar so I made a simple one for list controls.
    If anyone is interested here is how it works.
    Paste the code below in the javascript functions section of the ux. Change the list name to the one you want the search to work with.
    Code:
    function jsAlphabetSearch(sc)
    	{
    	var lObj = {dialog.object}.getControl('Insert_your_list_name_here');
    	if (sc == 'All')
    		{
    		lObj.setFilter(false);
    		}
    	else
    		{
    		lObj.setFilter({fileas: RegExp('^'+sc,'i')});
    		}
    	}
    copy the text in this file and paste it into your ux in a panel container. It is set up as a panel header
    alphabet_search.txt

    If anyone can improve, please do. If anyone, hhmm David, can make it so that the button text is red and the buttons are disabled when the search would return nothing please help.
    2015-06-17_17-37-54.png
    Last edited by frankbicknell; 06-17-2015, 10:17 PM. Reason: bad grammer
    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: missing alphabet search bar for list

    There was a posting last Nov. that talked about a ButtonList search for a UX with posted examples...
    http://www.alphasoftware.com/alphafo...light=alphabet


    Here's some code that may help with the items which would not return a hit...

    Code:
    var lObj = {dialog.Object}.getControl('list1');
    var lData = lObj._data;
    var searchChar = [];
    
    var alpha = "abcdefghijklmnopqrstuvwxyz";
    for(a=0;a<26;a++){
    
    	var currLetter = alpha.substr(a,1);
    	
    	for(i=0;i<lData.length;i++){
    		var currComp = lData[i].COMPANY;
    		if(currComp && currComp != ''){
    			var currCompLetter = currComp.substr(0,1);
    			var currCompLetter = currCompLetter.toLowerCase();
    			if(currCompLetter == currLetter){
    				searchChar.push(currCompLetter);
    			}
    		}	 
    	}
    }
    
    var uniqueLetters = searchChar.filter(function(item, pos) {
        return searchChar.indexOf(item) == pos;
    })
    
    for(z=0;z<uniqueLetters.length;z++){
    	var letterPos = alpha.indexOf(uniqueLetters[z]);
    	letterPos = letterPos + 1;
    	$('A5UID'+ letterPos).style.color = "red";
    	$('A5UID'+ letterPos).disabled = true;
    }

    Comment


      #3
      Re: missing alphabet search bar for list

      Thanks David,
      My search abilities are so poor. It would have saved me a lot of time if I would have found that posting.

      I will have to have another look at this whole thing again.
      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: missing alphabet search bar for list

        Originally posted by frankbicknell View Post
        Thanks David,
        My search abilities are so poor. It would have saved me a lot of time if I would have found that posting.

        I will have to have another look at this whole thing again.
        Use google instead of the terrible terrible terrible forum search function.

        You can uses the format shown here:
        site:http://www.alphasoftware.com/alphaforum/ list Alphabet
        just put site: before any site and after the last part of the url, a space and then your search terms.
        Way better than the forum search for sure.

        Comment


          #5
          Re: missing alphabet search bar for list

          Jinx a great big thank you for that tip.
          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


            #6
            Re: missing alphabet search bar for list

            Originally posted by -Jinx- View Post
            Use google instead of the terrible terrible terrible forum search function.

            You can uses the format shown here:
            site:http://www.alphasoftware.com/alphaforum/ list Alphabet
            just put site: before any site and after the last part of the url, a space and then your search terms.
            Way better than the forum search for sure.
            or use

            site:http://www.alphasoftware.com/

            which will search all documents and webpages for info.

            including release notes, etc.
            Al Buchholz
            Bookwood Systems, LTD
            Weekly QReportBuilder Webinars Thursday 1 pm CST

            Occam's Razor - KISS
            Normalize till it hurts - De-normalize till it works.
            Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
            When we triage a problem it is much easier to read sample systems than to read a mind.
            "Make it as simple as possible, but not simpler."
            Albert Einstein

            http://www.iadn.com/images/media/iadn_member.png

            Comment


              #7
              Re: missing alphabet search bar for list

              Thank you Al & Jinx. I have completed my first search and this will be a tremendous time saver for 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


                #8
                Re: missing alphabet search bar for list

                Here is the code that David generously supplied with a modification that makes it work for me.
                This needs to be streamlined. As soon as I get time to figure it out I will post the changes.
                I had to disable all of the buttons since this code returns a unique list of the characters that are in the list then process each one.
                I am trying to figure out a way to extract the characters that are not in the list and only process those.


                Code:
                var lObj = {dialog.Object}.getControl('LST_CUSTOMER');
                var lData = lObj._data;
                var searchChar = [];
                
                // ** added this section to disable all of the buttons and change the text color to red.
                [COLOR="#FF0000"]for(letterPos=1;letterPos<27;letterPos++)
                {
                	$('A5UID'+ letterPos).style.color = "red";
                	$('A5UID'+ letterPos).disabled = true;
                }[/COLOR]
                // **
                
                var alpha = "abcdefghijklmnopqrstuvwxyz";
                for(a=0;a<26;a++){
                	var currLetter = alpha.substr(a,1);
                	for(i=0;i<lData.length;i++){
                		var currComp = lData[i].fileas;
                		if(currComp && currComp != ''){
                			var currCompLetter = currComp.substr(0,1);
                			var currCompLetter = currCompLetter.toLowerCase();
                			if(currCompLetter == currLetter){
                				searchChar.push(currCompLetter);
                                               [COLOR="#FF0000"]break;[/COLOR] // no sense in continuing the loop if we have a match
                			}
                		}	 
                	}
                }
                var uniqueLetters = searchChar.filter(function(item, pos) {
                    return searchChar.indexOf(item) == pos;
                })
                
                //** changed this to change the buttons text black and enable the button.
                for(z=0;z<uniqueLetters.length;z++){
                	var letterPos = alpha.indexOf(uniqueLetters[z]);
                	letterPos = letterPos + 1;
                	[COLOR="#FF0000"]$('A5UID'+ letterPos).style.color = "black";[/COLOR]
                	[COLOR="#FF0000"]$('A5UID'+ letterPos).disabled = false;[/COLOR]
                }
                Last edited by frankbicknell; 06-21-2015, 11:22 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


                  #9
                  Re: missing alphabet search bar for list

                  Here's the code that will now take the full Alphabet and put it into an Array for us to use.
                  Then we'll find searchable characters.
                  Then we'll find the difference between the full Array and the Searchable Array and create an array for those items
                  What's left will be what cannot be searched... and that Array we'll use to disable the buttons.

                  Code:
                  var lObj = {dialog.Object}.getControl('list1');
                  var lData = lObj._data;
                  var searchChar = [];
                  var alphaArray = [];
                  
                  var alpha = "abcdefghijklmnopqrstuvwxyz";
                  
                  for(a=0;a<26;a++){
                  	alphaArray.push(alpha.substr(a,1));
                  }
                  //we now have Alpha in an Array	
                  
                  for(a=0;a<alphaArray.length;a++){
                  
                  	var currLetter = alphaArray[a];
                  	
                  	for(i=0;i<lData.length;i++){
                  		var currComp = lData[i].COMPANY;
                  		if(currComp && currComp != ''){
                  			var currCompLetter = currComp.substr(0,1);
                  			var currCompLetter = currCompLetter.toLowerCase();
                  			if(currCompLetter == currLetter){
                  				searchChar.push(currCompLetter);
                  				break;
                  			}
                  		}	 
                  	}
                  }
                  
                  //Now... let's find the different between our alphaArray and what we actually found
                  //The difference will be items that will not be found in a search
                  var a=[], noSearchChar=[];
                  for(var i=0;i<alphaArray.length;i++){
                  	a[alphaArray[i]]=true;
                  }	
                  for(var i=0;i<searchChar.length;i++){
                  	if(a[searchChar[i]]){
                  		delete a[searchChar[i]];
                  	}else{
                  		a[searchChar[i]]=true;
                  	}
                  }
                  for(var k in a){
                  	noSearchChar.push(k);
                  }
                  
                  //Now that we have the characters that will not satisfy as search, let's disable them
                  for(z=0;z<noSearchChar.length;z++){
                  	var letterPos = alpha.indexOf(noSearchChar[z]);
                  	letterPos = letterPos + 1;
                  	$('A5UID'+ letterPos).style.color = "red";
                  	$('A5UID'+ letterPos).disabled = true;
                  }

                  Comment


                    #10
                    Re: missing alphabet search bar for list

                    Thanks David for the update. I have discovered a new problem that when you close and then re-open the page that contains the alphabet search the unique id of the buttons increments so they are no longer A5UID1 ,2, 3, etc.
                    Is there a way to give each button a unique id in the static json definition of the button list control? i am not familiar with that technique. I went back to using a button group container with all of the buttons defined and having a unique id and then it works.
                    I also made another slight modification. I added a variable named si for start index. After we get a match then there is no point in starting the loop from 0 again. I have a large page loading so I want to save every millisecond that I can. Obviously that assumes your are sorted on the search field.

                    Code:
                    var lObj = {dialog.Object}.getControl('list1');
                    var lData = lObj._data;
                    var searchChar = [];
                    var alphaArray = [];
                    
                    var alpha = "abcdefghijklmnopqrstuvwxyz";
                    [COLOR="#FF0000"]var si = 0;[/COLOR] // set start index to 0
                    
                    for(a=0;a<26;a++){
                    	alphaArray.push(alpha.substr(a,1));
                    }
                    //we now have Alpha in an Array	
                    
                    for(a=0;a<alphaArray.length;a++){
                    
                    	var currLetter = alphaArray[a];
                    	
                    	for(i=[COLOR="#FF0000"]si[/COLOR];i<lData.length;i++){
                    		var currComp = lData[i].COMPANY;
                    		if(currComp && currComp != ''){
                    			var currCompLetter = currComp.substr(0,1);
                    			var currCompLetter = currCompLetter.toLowerCase();
                    			if(currCompLetter == currLetter){
                    				searchChar.push(currCompLetter);
                                                   [COLOR="#FF0000"]si = i+1;[/COLOR] // set start index to start on the next row after the last match
                    				break;
                    			}
                    		}	 
                    	}
                    }
                    
                    //Now... let's find the different between our alphaArray and what we actually found
                    //The difference will be items that will not be found in a search
                    var a=[], noSearchChar=[];
                    for(var i=0;i<alphaArray.length;i++){
                    	a[alphaArray[i]]=true;
                    }	
                    for(var i=0;i<searchChar.length;i++){
                    	if(a[searchChar[i]]){
                    		delete a[searchChar[i]];
                    	}else{
                    		a[searchChar[i]]=true;
                    	}
                    }
                    for(var k in a){
                    	noSearchChar.push(k);
                    }
                    
                    //Now that we have the characters that will not satisfy as search, let's disable them
                    for(z=0;z<noSearchChar.length;z++){
                    	var letterPos = alpha.indexOf(noSearchChar[z]);
                    	letterPos = letterPos + 1;
                    	$('A5UID'+ letterPos).style.color = "red";
                    	$('A5UID'+ letterPos).disabled = true;
                    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: missing alphabet search bar for list

                      Here is the code as streamlined as I can make it. I am just disabling the button no red text.
                      This works if you have a button group A - Z each with its own id ALPHASRCHBTN_1, ALPHASRCHBTN_2, etc.
                      The list has to be sorted on the search field.
                      Change the list id to your list. Change field searched to your field.

                      Code:
                      var lObj = {dialog.Object}.getControl('id_of_list');
                      var lData = lObj._data;
                      var searchChar = [];
                      
                      var si = 0;
                      var alpha = "abcdefghijklmnopqrstuvwxyz";
                      
                      for(a=0;a<26;a++)
                      {
                      	var currLetter = alpha.substr(a,1);
                      	for(i=si;i<lData.length;i++)
                      	{
                      		var currSearchField = lData[i].field_to_be_searched;
                      		if(currSearchField && currSearchField != '')
                      		{
                      			var currSearchLetter = currSearchField.substr(0,1);
                      			var currSearchLetter = currSearchLetter.toLowerCase();
                      			if(currSearchLetter == currLetter)
                      			{
                      				searchChar.push(currSearchLetter );
                      				si = i+1;
                      				break;
                      			}
                      		}
                      	}
                      }
                      
                      function charLoop(from, to, callback)
                      {
                          var i = from.charCodeAt(0);
                          var to = to.charCodeAt(0);
                          for(;i<=to;i++) callback(String.fromCharCode(i));
                      }
                          
                      var letterPos = 0;
                      
                      charLoop("a", "z", function(char) {
                      
                      var n = searchChar.indexOf(char); 
                      letterPos = letterPos + 1;
                      
                      if (n < 0)
                      {
                      $('{dialog.ComponentName}.V.R1.ALPHASRCHBTN_'+ letterPos).disabled = true;
                      }
                      
                      });
                      This is the javascript function. Change the list id to your list.

                      Code:
                      function jsAlphabetSearch(sc)
                      	{
                      	var lObj = {dialog.object}.getControl('id_of_list');
                      	if (sc == 'All')
                      		{
                      		lObj.setFilter(false);
                      		}
                      	else
                      		{
                      		lObj.setFilter({fileas: RegExp('^'+sc,'i')});
                      		}
                      	}
                      This is the button group, copy and paste into the ux component above the list.
                      alphabet_search.txt
                      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


                        #12
                        Re: missing alphabet search bar for list

                        Is there anyway of making this work for a viewbox?

                        Comment

                        Working...
                        X