1. Fabrik 3.7 is now available. This version contains critical security updates, please update as soon as possible. Please remember to backup your site before updating, we also recommend testing your updates on development sites if possible.
  2. We had to restore the site around midday (CST) on Wed 7/26 from a backup approximately 8 hours old. So a few posts in the forums were lost. You may want to check to see if you need to re-post anything.

Get ids of checked rows in list with sourcerer article plugin

Discussion in 'Professional Support' started by kouros91, Sep 11, 2017.

  1. kouros91

    kouros91 Member

    Level: Professional
    Hi.
    I would like to get ids of checked rows in the current display list, but with a js or php code inside an article with sourcerer, and not through php or js plugin list. Is it possible to get theses ids ?
    The idea is to create others function buttons like a horizonal menu.

    Thank you for answer.
     
  2. kouros91

    kouros91 Member

    Level: Professional
    No answer?
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Sorry, got caught up in a hurricane.

    So you need to do this "live" on the page in the browser? So when a user selects and unselects checkboxes, your code sees that, and gets the currently selected ones?

    -- hugh
     
  4. kouros91

    kouros91 Member

    Level: Professional
    Ok. I hope all is ok for you.
    I would like to add buttons (html buttons, not the fabrik buttons) (with php and js code in the article with sourcerer) and i would like to get selected rows ids of the display list when user click on my button. Yes i would like my code sees, gets selected rows ids.
    But i don't know how get ids of the selected rows , outside the js or php list plugin. Do you understand me ? Can you help me ?
    Thanks.

    Nicolas
     
    Last edited: Sep 13, 2017 at 5:10 PM
  5. kouros91

    kouros91 Member

    Level: Professional
    I've tried to create a list_id. Js but i can't get ids with my button in sourcerer code article.:(
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK, I've just added a new method to the list JS, getCheckedRowIds(), so you can do ...

    Code (Text):

    var ids = Fabrik.getBlock('list_X').getCheckRowIds();
     
    That will return an array of primary keys (ids).

    Replace X with the numeric ID of your list.

    And obviously you'll need to update from github.

    -- hugh
     
  7. kouros91

    kouros91 Member

    Level: Professional
    Ok. Thank you very much. I try tonight and I tell you. It will be very useful for me. Thank you again :)
     
  8. kouros91

    kouros91 Member

    Level: Professional
    It doesn't work :(. I've just make a button to display a checked row id. With sourcerer , here is my code :

    Code (Text):
    {source}

    <button id="test" onClick="showid()";>test</button>

    <script language="javascript" type="text/javascript">

    function showid() {
    var ids = Fabrik.getBlock('list_56').getCheckRowIds();
    var phrase ='ids :'.ids[0];
    alert (phrase);

    }

    </script>

    <?php


    ?>
    {/source}
    When i select one row and i click on the button, the console sends me : Uncaught TypeError: Fabrik.getBlock(...).getCheckRowIds is not a function
    I've updated with github. Is update from github ok ??
     
    Last edited: Sep 15, 2017 at 9:55 PM
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Oops, should be getCheckedRowIds

    Sent from my HTC6545LVW using Tapatalk
     
  10. kouros91

    kouros91 Member

    Level: Professional
    It works :)) Thanks ! :)
     
    Last edited: Sep 16, 2017 at 9:48 AM
    cheesegrits likes this.

Share This Page