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

list control woes

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

    list control woes

    I have a ux that has a list control. The list control is set to return the primary key of the fields from a mysql table. I would like to prevent a user from selecting certain items in the list control using the OnBeforeSelect Event. The only way I can figure on how to make it work the way I want is with an ajaxcallback in the OnBeforeSelect event. The problem is that the e._currentRowDataNew.listname object in the callback does not contain the key field value.
    Am I doing something wrong? Is this a bug? I know it is the OnBeforeSelect event but it should contain the key value otherwise how can you determine what list items can be selected or not?
    Last edited by frankbicknell; 05-11-2014, 11:13 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: list control woes

    I think you're misunderstanding what onBeforeSelect does. It does not test the value of the item you ARE selecting. onBeforeSelect fires before the select is done so that you can determine if anything else can be selected.

    E.g. If you only allow 2 selections, onBeforeSelect will know that and you can return false to prevent any further selections.

    You're thinking that onBeforeSelect will test the selection you just made and allow you to prevent that current selection... but it doesn't work like that.

    Is this a Single or Multi Select List Control? Do you allow nulls or not in the list?

    EDIT: The following info refers to a part of your post that you removed.
    I think you're a little too quick to "call bug". If you read the notes for the various "select" events you'll see references to the List allowing, or not, nulls items. Some of the events get fired when the List gets initialized. You need to test if the List is initialized before trying to access controls in the List. Have a look at the notes for onSelect. Those notes reference code such as...

    Code:
    if (this.initialized) {
    //then do your stuff
    }
    You can get at the Array of keys being selected and test that array for anything you do not want to allow. I think you may be able to reset that Array.

    Comment


      #3
      Re: list control woes

      Thanks David,

      I agree I am misunderstanding what the OnBeforeSelect does. I also figured out that I was using the placeholders incorrectly that is why I removed that sentence.
      I have figured out that I can get the key id in the onSelect event then do an ajax callback and do some sql mumbo jumbo and prevent the edit dialog from opening but it just seems so clunky and wrong. Plus the user has already selected the list item (wasting several seconds of time). I was hoping to just prevent the initial selection of the wrong time item.

      Let me try to explain what I am doing.

      This is a ux that contains service log data. It is opened from a list filtered by the id of the logged in tech
      2014-05-11_13-22-48.png
      When I click the time tab it opens another ux with the time data for the service log. When an item in the list is clicked it opens a dialog to edit the time record.
      2014-05-11_14-11-30.png

      I want the logged in, assigned tech to be able to see all of the time for the log but only be able to edit their own time.
      I had this all working in a grid but recently discovered lists. They are so much better for this process than grids, however there is a big learning curve for me and I'm not getting it.

      If you have any advice I would appreciate if you would share it with 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


        #4
        Re: list control woes

        Actually the sql mumbo jumbo ended up being only one sql_lookup so that was not so bad. Still seems like I should be able to prevent the selection in the first place. I can't even get the conditional formatting to work to give a visual indication of right and wrong. These list controls are a challenge.
        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: list control woes

          Yes... this is very easy to do staying client-side since the List control gives us everything we need to test with.

          You will need to get the assigned tech value into a client-side variable. Then you can use onSelect to test against that value. You don't need, nor should you need, to go back to the server for this.

          It looks like you're using a single-select List Control... which is actually a bit easier to work with than a multi-select List control. Here's an example that shows how to work with both single and multi select.

          http://www.youtube.com/watch?v=vYdFYJdwWzU

          Code for multi-select List, onSelect event
          Code:
          if (this.initialized){
          	
          	currCountry = {dialog.Object}._currCountry;		
          	var index = this.value.indexOf(currCountry);
          	//if (index > -1) {		//found the item
          	if (index == -1){			// did not fild the item
          		alert('Thank you for selecting ' + this.value);
          	} else {
          		this.selectionKey.splice(index, 1);
          		this.selection.splice(index, 1);
          		this.value.splice(index, 1);
          		this.selectionData.splice(index, 1);   
          		var listObj = {dialog.object}.getControl('LIST1');
          		listObj.refresh();
          		alert('Sorry... you can select anything except ' + currCountry);
          	}	
          
          }
          
          //	this.selectionKey					//List index zero based
          //	this.value							//Data values e.g. Canada
          //	this.selectionData				//Selection objects of data
          //	this.selection						//List index zero based
          Code for single-select List Control, onSelect event
          Code:
          if (this.initialized){
          
          		currCountry = {dialog.Object}._currCountry;		
          		if (this.value == currCountry){
          			alert('This selection is ok');
          		} else {
          			alert('This selection is NOT ok');
          		}
          }
          Last edited by Davidk; 05-11-2014, 04:55 PM.

          Comment


            #6
            Re: list control woes

            Thank you David for taking the time to help and educate me. I will digest all of this then put it to use. Your way is far better than mine.
            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: list control woes

              The server is great... but if you can stay client-side, you get lightning speed. If you need data, then you've got to go get it. But, if you have the data, stay put and get things done really fast.

              Comment

              Working...
              X