Alpha Video Training
Results 1 to 8 of 8

Thread: how do I refresh a list and activate a certain row

  1. #1
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,563

    Default 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 Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,567

    Default 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 at 06:06 PM.

  3. #3
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,563

    Default 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 Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  4. #4
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,567

    Default 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 at 12:16 PM.

  5. #5
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,563

    Default 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 Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  6. #6
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,567

    Default 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.

  7. #7
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,563

    Default 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 Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  8. #8
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,567

    Default 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.

Similar Threads

  1. Refresh List in UX
    By Ronald Anusiewicz in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 10-04-2015, 03:18 PM
  2. XD: How to refresh list using external_record_content_get
    By MoGrace in forum Alpha Five Version 11 - Desktop Applications
    Replies: 5
    Last Post: 03-31-2015, 12:24 AM
  3. activate drop down list on field entry
    By DRT1200 in forum Alpha Five Version 10 - Desktop Applications
    Replies: 6
    Last Post: 01-05-2011, 12:24 AM
  4. Refresh Record List - List Box Control
    By jdrake in forum Alpha Five Version 9 - Desktop Applications
    Replies: 8
    Last Post: 08-14-2009, 08:54 PM
  5. X-Dialog Refresh Record-List List-Box
    By Louis Nickerson in forum Alpha Five Version 5
    Replies: 7
    Last Post: 02-20-2003, 07:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •