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

> Best Way To Define a Session Variable On Right Click?

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

    > Best Way To Define a Session Variable On Right Click?

    I would like to define a session variable which is needed to filter a popup window and the code I have written isn't working fast enough.

    *The session variable is what I'm using as the argument to filter the window, I have never used a cookie variable so wouldn't know how to go about that, and I can't use page variables as it's per row that the variable is decided.

    ***Has to work on Right Click for a container sub-type as a window.

    Can I define a session variable in Javascript?

    Can I clear session variables in Javascript?

    Below is what I'm doing (but it's not working).

    Code:
    //SETS FOCUS TO THE LIST ON RIGHT CLICK (NOT NEED FOR ONCLICK)
    	this.setValue(arguments[0]); 
    
    //SET VARIABLES 
    	var listPK = this.selectionData[0].client_list_id;
    	var oldProsLvl = this.selectionData[0].status_prospect_level_id
    
    //AJAX CALLBACK --- [B]FILL SESSION VARIABLES[/B]
    	{grid.Object}.ajaxCallback('G','{Grid.RowNumber}:all','showActionList','','_primaryKey='+listPK+'&_oldProsLvl='+oldProsLvl,{deviceOfflineFunction: function() { alert("Internet Connection Interruption, Please Re-Connect.");  }});
    
    
    //RUN ACTION TO GET CLIENT LIST ID - [B]Open Filtered Window[/B]
    	{dialog.object}.runAction('openProspect_ActionList');

    #2
    Re: > Best Way To Define a Session Variable On Right Click?

    To make things easy... it looks like you have 4 sections to get done.

    In section 3 you want to set a session variable that you are going to use in section 4. Is that right?

    I would first try this...

    Don't run section 4 where it is. Run your "runAction" in the return from your ajax callback. That way the session variable to set for sure before the action runs... I hope.

    Comment


      #3
      Re: > Best Way To Define a Session Variable On Right Click?

      Oh, I didn't even think about that. I will try it now. :-)

      Comment


        #4
        Re: > Best Way To Define a Session Variable On Right Click?

        So I just changed the third section (and did away with the fourth) to this:

        Code:
        {grid.Object}.ajaxCallback('G','{Grid.RowNumber}:all','showActionList','','_primaryKey='+listPK+'&_oldProsLvl='+oldProsLvl,{onComplete: function() { {dialog.object}.runAction('openProspect_ActionList');},deviceOfflineFunction: function() { alert("Internet Connection Interruption, Please Re-Connect.");  }});
        I get no errors, everything looks like it should work, but my session variable wont change. It stays the same no matter what row I click on. Just to make sure it was the session variable that was the problem and not the argument that filled the session variable, I did a right click on the list that I just opened to display the action and alerted the session variable and it says the same cached variable, it wont change.

        I feel like I'm missing something really basic. I know that my ajax callback is working which fills in the session variable.

        I tested this with the following code after the variable is filled, and get new values with every right click.

        Code:
        function showActionList as c (e as p)	
        	dim session.clientListID as c = convert_type(e._primaryKey, "C") 		'_primaryKey Variable defined "onclick" action of the list
        	dim session.prosLevel as c = convert_type(e._oldProsLvl, "C")			'_oldProsLvl Variable defined "onclick" action of the list 
        
        	[B]
                dim jtxt as c = ""
        	jtxt = "alert(" +  session.clientListID + ");"
        	showActionList = jtxt
                [/B]
        end function
        So I guess, somehow my argument isn't being updated with the session variable. That's really the only thing left, right?

        Comment


          #5
          Re: > Best Way To Define a Session Variable On Right Click?

          Ok... then it's because you're filtering using a session variable. How, specifically are you doing this.

          I believe that a session variable cannot be used "dynamically" as a filter. The first time it's set... that's it... no changes.

          Comment


            #6
            Re: > Best Way To Define a Session Variable On Right Click?

            Really? I didn't know that.

            I have prospects_list which has a right click action to open another list, the above is all in reference to the right click of that list.

            At the end of the right click, the action is to open a window which contains a list (Prospect_Action_Menu).

            The Prospect_Action_Menu, under list properties has an argument which is set as a character value for my session variable clientListID.

            The list is than filtered using the argument that I set up above (in the select statement). The argument is also set to character.

            That's it. The list opens without a problem, and picks an old session variable to use to filter itself. :-/ That list itself believes it's following the right session variable (since my right click on that list matches the results it's displaying)

            Comment


              #7
              Re: > Best Way To Define a Session Variable On Right Click?

              Is this all in the same UX? So, the right-click is opening what looks like a right-click menu on the Prospect List... right?

              Just so I understand... why the ajax callback to see session variables? Is this just to filter the right-click list?

              Comment


                #8
                Re: > Best Way To Define a Session Variable On Right Click?

                There are a couple of ways to get this done. The difference between the 2 methods depends, I believe, on how much data you've got.

                One way involves a call back to the server (Alpha takes care of all the details). This queries the tables and sends back the records for display.
                The other way involved applying a Client side filter to the List. So all records are in the List... you're just filtering them.

                Here are both methods... try them both and see which is best in your situation. I'm using a setTimeout when showing the window... just to give the filter a second to work. Adjust the timing to suit... or you don't need to use it at all.

                The list property... Delay Render till visible can be turned on for the _filterList method... but not for the .setFilter method.

                First... the .setFilter method...

                Code:
                this.setValue(arguments[0]);
                var custId = this.selectionData[0].CUSTOMER_ID;
                
                var lObj = {dialog.object}.getControl('list2');
                
                //search using a single function. data for the entire current row is passed into the function
                lObj.setFilter(function(data){
                     // data is the row data
                    if(data.CustId == custId && data.InvoiceNbr == 'INV002') return true; // yes, show this row
                    else return false // no, hide this row
                });
                
                setTimeout(function(){
                	{dialog.Object}.showContainerWindow(this,'WINDOW_1');
                },500);	
                
                //clear the filter
                //lObj.setFilter(false);
                And here's the _filterList method...

                Code:
                this.setValue(arguments[0]);
                var custId = this.selectionData[0].CUSTOMER_ID;
                
                // params must take the form.... value ||| type | argName \n value ||| type | argName
                
                var params = custId + '|||N|whatCust\nINV002|||C|whatInv';
                
                {dialog.object}._filterList('LIST2','CustId = :whatCust AND InvoiceNbr = :whatInv','',params);
                
                setTimeout(function(){
                	{dialog.Object}.showContainerWindow(this,'WINDOW_1');
                },500);

                Comment


                  #9
                  Re: > Best Way To Define a Session Variable On Right Click?

                  So I started out really confused trying to figure this out, but I just plugged it in. And I almost gave up but then I realized that the argument was still filtering my list, so I removed that and followed the first method (.setFilter). My list will always only have 6 records

                  Here is my code

                  Code:
                  this.setValue(arguments[0]);
                  var listPK = this.selectionData[0].client_list_id;
                  var lObj = {dialog.object}.getControl('Prospect_Action_Menu');
                  
                  //search using a single function. data for the entire current row is passed into the function
                  lObj.setFilter(function(data){
                       // data is the row data
                      if(data.client_list_id == listPK) return true; // yes, show this row
                      else return false // no, hide this row
                  });
                  
                  //setTimeout(function(){
                  	{dialog.Object}.showContainerWindow(this,'ACTION_MENU_PROSPECTS');
                  //},500);
                  My second table doesn't require a filter, I show all the results no matter what. So this actually works, and I can skip the need to set the session variables, which is great! The only problem that I am having now is, that the page takes forever to load, so what I attempted (which did not work) on the list on before populate action is:

                  
                  Code:
                  var lObj = {dialog.object}.getControl('Prospect_Action_Menu'); 
                  ////var adminID = {dialog.Object}.getSessionVariable('admin_id');
                  //
                  ////search using a single function. data for the entire current row is passed into the function
                  lObj.setFilter(function(data){
                       // data is the row data
                    	//if(data.admin_id == adminID && data.client_list_id == 0) return true; // yes, show this row
                    	if(data.client_list_id == '0') return true; // yes, show this row    
                      else return false // no, hide this row
                  });
                  and I also tried (also didn't work) on the same action:

                  Code:
                  {dialog.object}._listRemoveAllRows('Prospect_Action_Menu');

                  The second example I don't think I can get my head around, but if you think it's better I will try.

                  Comment


                    #10
                    Re: > Best Way To Define a Session Variable On Right Click?

                    Yes... I think in this case, because you most likely have a lot of records coming into the 2nd list, that using the _filterList method is best. That way the List doesn't get loaded with a bucket of records and then filtered. Instead, the server will filter and present just what you need.

                    Comment

                    Working...
                    X