Alpha Video Training
Results 1 to 4 of 4

Thread: Move row from source to target list then save

  1. #1
    Member
    Real Name
    Darren Parsons
    Join Date
    Aug 2015
    Posts
    188

    Default Move row from source to target list then save

    Good day all

    I think I must be missing something pretty simple here - but it's got me stumped.

    I am working on a quoting system. I allow the user to retrieve a standard template of items and these items are loaded in a list. I then use the action javascript to move the rows from that list to the list that is attached to my active quote. The idea is the salesperson can retrieve a long list of items, make any edits that they need to and then save them. Sometimes there's no editing required, just look up the rows, transfer to my target list and save them.

    Here's my problem, I cannot get them to save from my target list. The rows move over nicely but when I try and save the target list the records are not saved. You would think that if alpha gave you an action javascript to move a whole pile of rows from a source to a target list, it would also allow you to save the target records?

    What am I missing?

    Thanks

    Darren

  2. #2
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    344

    Default Re: Move row from source to target list then save

    Is the target list's data source a SQL query? And you would like the new rows that were moved to the target list to be saved to the back-end database?
    Or just save somewhere on the client device?

    If you need it to save back to a database, does the target list have the "Has Detail View" property checked?

    That being said, the Action Javascript to move the row doesn't add, as far as I can see, the necessary meta-data needed to the new row in order to sync it later.

    One way to do this might be to, on the click or selection of the row in the source list, create a new detail view record for the target list.
    Code:
    var lObj = {dialog.object}.getControl('LIST_TARGET');
    lObj.newDetailViewRecord();
    Then configure the target list's new record's detail view defaults to get your specific required values from the source list.
    Then save the source list's new record with:
    lObj.updateListFromUXControls();

    Alpha doesn't prevent you from saving any records. They just can't really guess what your requirements might be after moving a row from one list to another.

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

    Default Re: Move row from source to target list then save

    Do you want to move ALL rows... or SELECTED rows from the Source List to the Target List? The process for doing either is essentially the same... it's just the source data that changes a bit.

    To move all rows...

    Code:
    var sourceData = {dialog.Object}.getListData('LISTCUSTSOURCE');
    var targetList = {dialog.object}.getControl('LISTCUSTTARGET');
    targetList.addTableRowsBulk(sourceData);
    To move selected rows from a multi-select List...

    Code:
    var sourceList = {dialog.Object}.getControl('LISTCUSTSOURCE');
    var sourceData = sourceList.selectionData;
    var targetList = {dialog.object}.getControl('LISTCUSTTARGET');
    targetList.addTableRowsBulk(sourceData);
    If your target List is persisting data, then you need to be concerned about turning persistence off, then back on, and then persisting data. Have a look here for more information... https://documentation.alphasoftware....w%20Method.xml
    Last edited by Davidk; 05-15-2019 at 11:36 AM.

  4. #4
    Member
    Real Name
    Darren Parsons
    Join Date
    Aug 2015
    Posts
    188

    Default Re: Move row from source to target list then save

    Thanks for the responses. I did get it working using the addTableRowsBulk

Similar Threads

  1. Select target list row
    By fcastillo in forum Mobile & Browser Applications
    Replies: 9
    Last Post: 03-13-2018, 04:23 PM
  2. Split menu hierarchical list - move from static to SQL list actions?
    By Malcolm in forum Mobile & Browser Applications
    Replies: 3
    Last Post: 10-25-2016, 04:44 AM
  3. List control with custom data source and parent list
    By sjackson@drake in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 07-01-2015, 09:26 PM
  4. Dialog save error - no message in red - debugger says NO SOURCE CODE
    By zumik in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 07-02-2013, 03:38 AM
  5. append unique source rows to target with autoincrement column?
    By Freewilly3d in forum Alpha Five Version 11 - Desktop Applications
    Replies: 2
    Last Post: 05-29-2013, 09:05 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
  •