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

how do I refresh a list and activate a certain row

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

    how do I refresh a list and activate a certain row

    I have a filtered list. The list has buttons in each row. One button only shows when a condition is met.
    Double click on the row leaves the panel containing the list an navigates to a second panel where data entry is done.
    When saving the entry, the condition needed to show the button is saved. I have found that I have to refresh the list
    so I can see the button.

    The trouble is that refreshing the list moves the active list row to the first row of the list.
    I want to keep the active row the same as the row I was working on. In some cases, it could be row 165.
    I have made many an attempt to activate the row that I was editing, but just can't get there.

    Any help is appreciated. Thanks.

    The following code is in the submit button Javascript click event.
    Code:
    function tempfunction_7ce121d7_68ff_44bd_b891_25d6dbc1c3a5() {
    {dialog.object}.submit();
    }
    
    function tempfunction_2e15d282_1c1a_41f5_8b99_93d40aa0b0cb() {
    {dialog.Object}.setDisabled('BUTTON_SUBMIT');
    }
    
    function tempfunction_01ec0d8d_4574_4058_ae21_513e50445a04() {
    {dialog.object}.fadeOutMessage('{dialog.componentname}.V.R1.SAVED_MSG','Saved',2000,true);
    }
    
    function tempfunction_a61fb9f8_ac89_42a9_9822_fd68053a6199() {
    var myVar = setTimeout(myTimer, 2000);
    
    function myTimer() {
    var data = {dialog.object}.panelSetActive('WORK_ORDER_ITEMS',true);
    	}
    }
    
    function tempfunction_01ec0d8d_4574_4058_ae21_513e50445512() {
    //var l = {dialog.object}.getControl('WO_Items');
    //l.setValue(rowNumber,false);
    //alert(rowNumber);
    var myVar = setTimeout(myTimer, 2000);
    
    function myTimer() {
    {dialog.object}.refreshListData('WO_Items');
    	}
    }
    
    A5.executeThisThenThat(tempfunction_7ce121d7_68ff_44bd_b891_25d6dbc1c3a5,tempfunction_2e15d282_1c1a_41f5_8b99_93d40aa0b0cb,tempfunction_01ec0d8d_4574_4058_ae21_513e50445a04,tempfunction_a61fb9f8_ac89_42a9_9822_fd68053a6199,tempfunction_01ec0d8d_4574_4058_ae21_513e50445512);
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    #2
    Re: how do I refresh a list and activate a certain row

    There are probably 5 different ways to set up a button in a List row with a conditional expression. In some cases a conditional expression is available both server-side and client-side.

    You'd need to provide, preferably, a simple sample UX to show your issue. Otherwise a detailed description of how and where your buttons are defined... and how and where the conditional expression is set.

    In a simple test I've just done, simply saving the detail view fires the conditional expression I have for a button without needing to do anything further to show or hide the button. And this is just saving. I haven't even synced yet.

    The code you've set up is far too extreme and, I believe, unnecessary. Even if you do need it, I'd suggest getting rid of those uuid numbers and just naming your functions something meaningful. I know that's what Alpha creates, but that's required for Actions. Since you've converted to code, don't use those horrible function names.

    In looking at the functions you've created... they, themselves are too complex. You've created setTimeout functions to call functions. Do this instead...

    Code:
    function Panel_WORK_ORDER_ITEMS() {
       setTimeout(function(){
          {dialog.object}.panelSetActive('WORK_ORDER_ITEMS',true);      
       },2000);
    }
    And... why are you setting a global variable data to a panelSetActive() method?

    I feel you're getting wrapped around the axle a bit.
    Last edited by Davidk; 11-24-2017, 07:06 PM.

    Comment


      #3
      Re: how do I refresh a list and activate a certain row

      David,

      Thank you so much for your reply. First, I did revise my code. This is where I am at for now.

      Code:
      function FirstSave() {
      {dialog.object}.submit();
      }
      
      function SaveMsg() {
      	{dialog.object}.fadeOutMessage('{dialog.componentname}.V.R1.SAVED_MSG','Saved',2000,true);
      	
      	setTimeout(function(){
      		{dialog.object}.panelSetActive('WORK_ORDER_ITEMS',true);	
      	},2000);
      }
      
      function RefreshList() {
      	setTimeout(function(){
      		{dialog.object}.refreshListData('WO_Items',true);	
      	},2000);
      }
      
      A5.executeThisThenThat(FirstSave(),SaveMsg());
      
      //A5.executeThisThenThat(FirstSave(),SaveMsg(),RefreshList());
      1. I'm working with 2 dbf tables. When a mechanic enters his time against a discrepancy, using the AfterDialogValidate Event, I have xbasic code which writes his entry to 2 different tables. A labor table and a corrective action table.

      2. The list is built on 2 DBF tables: Squawk with a child Corrective Action.

      3. I'm not using a DetailView. (Not sure why, just the way I did it. Lack of knowledge.)

      4. The button is controlled by a client side expression: len(alltrim(Ml) ) > 1. MI is a field in the list but is not visible. As long as this field has more than 1 character , the button is visible.

      5. What's happening now is that after running the above code, the active row can be the same as the row just edited, or can be any other row in the list.

      6. If I remove the.refreshListData, the active row remains the same as the row just edited. But then the button doesn't show.
      Alpha 5 Version 11
      AA Build 2999, Build 4269, Current Build
      DBF's and MySql
      Desktop, Web on the Desktop and WEB

      Ron Anusiewicz

      Comment


        #4
        Re: how do I refresh a list and activate a certain row

        I don't think you're using the List Control to it's full potential. You should review the Detail View option for the List. However, for now you can use an option of the .refreshListData() method.

        Code:
        var options = {};
        options.keepFocusOnCurrentSelection = true;
        {dialog.object}.refreshListData('LISTCUST',options);
        The keepFocusOnCurrentSelection option does just what it says. If you have selected row 160 to work on, then refresh the List, your data changes will be reflected in the refreshed List, but your current selection will stay on row 160.

        https://www.alphasoftware.com/docume...a%20Method.xml

        The way you've set up your UX and data entry, your button conditional issues should be expected. The conditional expression operates on the client-side... on data it can see. You're changing data in your database, but no data changes have taken place on the client... until you perform a refresh... and then the conditional expression kicks in... because the list data changed.

        You can cheat a bit, if you want to. If you know the row number you're working on (zero based), you can update the List (client-side only - just for display) and that update will trigger your conditional expression.

        Code:
        var lObj = {dialog.Object}.getControl('LISTCUST');
        var _data = {};
        _data.Status = 'Active';
        lObj.updateRow(0,_data);
        Here I'm getting my List control, and setting my List Field named "Status" to a value of 'Active'. The .updateRow() List method changes the data shown in the List.

        https://www.alphasoftware.com/docume...w%20method.xml

        Then you can perform your List refresh. If your data update fails for some reason, your List data column will change back to what is in the database.

        Also, your executeThisThenThat only needs to call each function... without the (). E.g.

        Code:
        A5.executeThisThenThat(FirstSave,SaveMsg);
        However, you can probably get rid of all that stuff because using the .updateRow method you don't need to wait for the refresh.
        Last edited by Davidk; 11-25-2017, 01:16 PM.

        Comment


          #5
          Re: how do I refresh a list and activate a certain row

          David,

          Thank you for your detailed explanation. The var options example does not work. Meaning after the refresh, the active row can be anywhere in the list. It can be the row just edited or a couple rows away or anywhere else in the list.

          How does one determine the active row before refreshing the list and then make that row active after a refresh.
          Alpha 5 Version 11
          AA Build 2999, Build 4269, Current Build
          DBF's and MySql
          Desktop, Web on the Desktop and WEB

          Ron Anusiewicz

          Comment


            #6
            Re: how do I refresh a list and activate a certain row

            Ron, I don't know what other code you have running or how your parent/child lists are set up, but a .refreshListDate(), by default, keeps focus on the currently selected row. I thought the default was false, but I re-read the doc, and the default is true... the selected row in a List stays selected after a refresh.

            In my List, DBF, parent/child test, the selected row in each List stays selected after a .refreshListData().

            You'd have to post a test UX to show the issue you're having.

            Comment


              #7
              Re: how do I refresh a list and activate a certain row

              Thanks David,

              As it turns out, the list was set to return the key value of the child table instead of the key value of the parent table.
              I changed the return field to the key of the parent and after each .refreshListData(), the active row is the correct row, row just edited.
              Alpha 5 Version 11
              AA Build 2999, Build 4269, Current Build
              DBF's and MySql
              Desktop, Web on the Desktop and WEB

              Ron Anusiewicz

              Comment


                #8
                Re: how do I refresh a list and activate a certain row

                Right... there are a hundred settings that can mess this stuff up. If everything is set up right... no issues. One setting wrong and odd results creep in. This is why a sample ux helps a lot.

                Comment

                Working...
                X