Alpha DevCon 2018
Results 1 to 10 of 10

Thread: Select target list row

  1. #1
    Member
    Real Name
    Francisco Castillo
    Join Date
    Jun 2017
    Posts
    37

    Default Select target list row

    Hello everyone! is there any way that I can select a list target row using javascript? This is what I have made
    function clientesClick(numero){
    var listObj = {dialog.object}.getControl('lst_clientes');
    listObj.setValue({select: 'add', value: numero});
    {dialog.object}.panelSetActive('CLIENTESVIEW');
    }

    but the problem is that in PhoneGap build it behaves badly.

    Thank you!

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

    Default Re: Select target list row

    What you've asked for... and the code you've posted... don't really match.

    The code you've posted is intended to work against a List that has been configured as multi-select... and "adds" the row with a value of numero to any rows that may already have been selected.

    Is that what you're intending to do? And... what does "behaves badly" mean... could you be specific?

    If you're working with a single-select List Control, then using .setValue(row); will work... where row is either a zero-based row number... or the value of a column matching whatever the Return field is set to.

  3. #3
    Member
    Real Name
    Francisco Castillo
    Join Date
    Jun 2017
    Posts
    37

    Default Re: Select target list row

    Thanks for helping Davidk. What I'm trying to accomplish is to select a target row from a list. the problem is that when i run the script, the target row is briefly selected and immediately the first row gets selected, leaving the list with the wanted row unselected.

    Following your advice, this is the script that is currently running but without success:

    var listObj = {dialog.object}.getControl('lst_clientes');
    console.log(numero);
    listObj.setValue(numero);

    where the variable numero is the row key number of the selected list

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

    Default Re: Select target list row

    Are you running something on an event in the List which is interfering with your code? onSelect event maybe?

  5. #5
    Member
    Real Name
    Francisco Castillo
    Join Date
    Jun 2017
    Posts
    37

    Default Re: Select target list row

    Nope! Just checked and there is no event triggering in the list

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

    Default Re: Select target list row

    You'd need to post a sample.

  7. #7
    Member
    Real Name
    Francisco Castillo
    Join Date
    Jun 2017
    Posts
    37

    Default Re: Select target list row

    this is the list layout:
    <div class="card" style="margin: 1px;">
    <div class="card-content card-content-padding list media-list" style="padding:0px">
    <ul>
    <li class="swipeout">
    <div class="item-content swipeout-content">
    <div class="item-inner">
    <div class="item-title-row">
    <div class="item-title"><b>{customerName}</b></div>
    <div class="float-right">{country}</div>
    </div>
    <div class="item-subtitle"><i class="fa fa-user" aria-hidden="true"></i> {contactFirstName} {contactLastName}</div>
    <div class="item-subtitle"><i class="fa fa-map-marker" aria-hidden="true"></i> {addressLine1} {addressLine2}, {city} {state} CP {postalCode}</div>
    <div class="item-subtitle"><i class="fa fa-phone" aria-hidden="true"></i> {phone}</div>
    </div>
    </div>
    <div class="swipeout-actions-right">
    <a class="color-blue" onclick="window.location = 'tel:{data:phone}';" ontouchstart="window.location = 'tel:{data:phone}';">
    <i class="fa fa-phone fa-2x" aria-hidden="true"></i>
    </a>
    <a class="color-orange" onclick="clientesClick({<RowKeyNumber>});" ontouchstart="clientesClick({<RowKeyNumber>});">
    <i class="fa fa-info fa-2x" aria-hidden="true"></i>
    </a>
    </div>
    </li>
    </ul>
    </div>
    </div>

    And my javascript functions:
    var app = new Framework7();

    function clientesClick(numero){
    // var listObj = {dialog.object}.getControl('lst_clientes');
    // listObj.setValue({select: 'add', value: numero});
    // {dialog.object}.panelSetActive('CLIENTESVIEW');

    var listObj = {dialog.object}.getControl('lst_clientes');
    console.log(numero);
    listObj.setValue(numero);

    }

    Currently using framework7 in the project.

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

    Default Re: Select target list row

    Sorry... what I should have written... can you post a sample UX. Also, you should probably have led with... "Currently using framework7 in the project."

  9. #9
    Member
    Real Name
    Francisco Castillo
    Join Date
    Jun 2017
    Posts
    37

    Default Re: Select target list row

    Yes! Heres a capture of the UI WhatsApp Image 2018-03-13 at 5.09.41 PM.jpeg

    each row is swipable and has 2 action buttons: calling feature, and a panelSetActive to show the detail view of the selected in the list. The problem is that in the phone, when you swipe to get access to the rows button, there isnt a select action of the row, so i thought of just making a function call where gets selected on code. And the problem with the function that is being made is the one described before: the row gets selected by a milisecond and then the first row gets selected.

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

    Default Re: Select target list row

    Sorry... let me try again. Duplicate your UX, but use Static Data, or include a SQL Table dump, and then zip that UX and post it here.
    Last edited by Davidk; 03-13-2018 at 09:11 PM.

Similar Threads

  1. Replies: 2
    Last Post: 10-05-2016, 12:33 AM
  2. Make list multi-select or single select dynamically
    By mikeallenbrown in forum Mobile & Browser Applications
    Replies: 3
    Last Post: 08-31-2015, 06:08 PM
  3. Replies: 0
    Last Post: 08-15-2014, 06:11 PM
  4. Select all items in multi-select list box by default
    By Jay Talbott in forum Alpha Five Version 8
    Replies: 10
    Last Post: 02-02-2012, 06:27 PM
  5. Embedded Multi-Select Check box list To Filter another checkbox list
    By aaronhaul in forum Alpha Five Version 10 - Desktop Applications
    Replies: 2
    Last Post: 01-10-2012, 03:37 PM

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
  •