1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.

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: Community
    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: Community
    No answer?
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    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: Community
    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
  5. kouros91

    kouros91 Member

    Level: Community
    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: Professional
    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: Community
    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: Community
    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
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Oops, should be getCheckedRowIds

    Sent from my HTC6545LVW using Tapatalk
     
  10. kouros91

    kouros91 Member

    Level: Community
    It works :)) Thanks ! :)
     
    Last edited: Sep 16, 2017
    cheesegrits likes this.

Share This Page