Alpha Video Training
Results 1 to 3 of 3

Thread: GetCheckedValues

  1. #1
    Member
    Real Name
    Jeremy Scrime
    Join Date
    Sep 2015
    Posts
    99

    Default GetCheckedValues

    The documentation for the javascript GetCheckedValues of a list control states that this method returns an array of values.

    I placed a button on a UX component that does an ajax callback and in the additional data to submit I put a javascript function that returns the name value pair of the values that the end user has checked in the list.

    For whatever reason, I can't get the XBasic right to use that array of checked values as an argument in a sql select.

    Can anyone point me in the right direction on this?

    javascript.png

    xbasic.png

  2. #2
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,388

    Default Re: GetCheckedValues

    I could be wrong but I think you need to pass data to the javascript function.
    It also looks like the xbasic isn't quite right, but I can't see all of it.

    Pasting the actual text makes it easier to work with.

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

    Default Re: GetCheckedValues

    The values that you're after are not what you think you're getting... they are not the record keys of the rows you've selected. Remember that the List Checkbox functionality, although a good concept, has had little to no testing.

    The .getCheckedValues() method returns an Array of data... but the data is CRLF delimited... which is bizarre. Also, not only do you get the List Row data, but you also get 3 additional columns of data... but no explanation what the data is. And finally, all the data for each row is repeated 3 times.

    It's a mess... because there has been no testing.

    When you pass this Array to XBasic (which you can't really do)... all you get is the last selected row of data (repeated 3 times).

    So... you must pre-process this array mess at the client... and then pass a string of comma delimited keys to XBasic.

    Code:
    var lObj = {dialog.object}.getControl('LISTCUST');
    var chkValues = lObj.getCheckedValues();
    var valArray = [];
    
    for(i=0;i<chkValues.length;i++){
    	valArray[i] = chkValues[i].split("\n");
    }
    
    var keyArray = [];
    for(i=0;i<valArray.length;i++){
    	keyArray[i] = valArray[i][0];
    }
    
    var keyStr = keyArray.join();
    
    var myData = A5.ajax.buildURLParam('__myRenewList',keyStr);
    {dialog.Object}.ajaxCallback('','','getCheckedValues','',myData);
    Here we get the array mess and convert the data to an Array. So now we have an Array of data... within an Array of rows. In this case, my key is the 1st member of the array.
    Now we process the Array of data, getting the row Key and putting the keys into an Array.
    Finally, convert the Array of keys into a comma-delimited string... and pass that string into XBasic.

    Even in the latest pre-release, the entire List shifts 2 pixels (per Selwyn) to the right when you first check a row. Alpha simply won't test it or fix it... maybe they can't. They fixed it once... but they can't seem to fix it a 2nd time. It's a head scratcher why this very useful functionality has been such a mess from the beginning.

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
  •