1. Important notice about Cloudbleed - if your site uses the Cloudflare CDN, and you intend to follow the Joomla security team's advice to change your site "secret", you MUST READ THIS NOTICE.
  2. Joomla 3.7 will be releasing soon (they just released RC2). If you intend to upgrade to 3.7, you will also have to update Fabrik, which will get an update as soon as 3.7 is released. Now would be a good time to do some testing - clone your site with Akeeba, update Joomla to the 3.7 RC2, and update Fabrik from github.
  3. Fabrik 3.6 will be released tomorrow (April 26th). This is a required update for Joomla 3.7, which released today. If you have updated to Joomla 3.7, and are not running recent github code for Fabrik, you may experience issues until you can update to Fabrik 3.6. If you haven't updated to Joomla 3.7, we suggest you hold off doing so until Fabrik 3.6 is released.

JavaScript list plugin

Mar 24, 2017
JavaScript list plugin
  • js-options.png
    • Button label - Button label
    • Button image-
    • JavaScript file - File to run, located in plugins/fabrik_list/js/scripts. Set 'statusMsg' to return a status message which will override any static message configured below.
    • JavaScript Code - If no file selected then the JavaScript code entered here will be evaluated. Set 'statusMsg' to return a status message which will override any static message configured below.
    • Success message

    Notes (top)


    A couple of useful variables: (top)

    Code (Javascript):

    console.log(ids); //outputs an array of the selected row ids
    console.log(rows); // outputs a object key'ed on the selected row ids, each value is an object containing the row data.
     

    Accessing list data (top)


    You can get at the selected row data by iterating through the 'rows' variable:

    Code (Text):

    jQuery.each(rows, function(rowid, row) {
       // echo the value of yourtable___yourelement to the console
       fconsole(row.yourtable___yourelement);
    })
     
    You can get at the whole list's data through the list objects 'data' option. First you need to get at the main Fabrik "block" for the list ...

    Code (Text):
    var listdata = Fabrik.getBlock('list_123').options.data
    ... would get you the main data object (replace 123 with your list's numeric ID).

    That data is then grouped, according to your list's current display grouping, using sequentially numbered indexes starting at 0 for each group.

    If your display is not grouped, it'll all be in listdata[0]. Which is then indexed by row number (not PK value, just the sequential display count, starting at 0). And that then contains another 'data' object, which has all the element values in it. So if you wanted to get the value of 'yourtable___yourelement' in the third row of the first (or only group) ...

    Code (Text):
    var myelement = listdata[0][2] .data.yourtable___yourelement;
    Note that this will give you the "formatted" value, so (for example) if you that element as a detail view link, the above code will give you the data with the A tag round it. If you just want the raw, unformtted data, just append _raw to the element name (yourtable___yourelement_raw).

    And of course you can iterate through the data object, or otherwise do with it what you need to, using standard JS.
  • Loading...