1. Hugh (cheesegrits) here. Thank you for all the good wishes. My back surgery was a success, post-op recovery is going well, and I'm getting stronger and feeling better every day. I hope to be getting back in the saddle and working support again over the next few days.
  2. IMPORTANT NOTE - we have made some changes in our github branch naming. The 'master' branch no longer exists, and is now called 'joomla25' (which is Fabrik 3.0). The 'joomla3' branch (which is Fabrik 3.2) remains unchanged. We have also removed all the other testing branches which had accuulated over the last few years. I have posted a thread in the Community forum for 3.0 with some more information, feel free to as questions there.

default value for element filter on a table view

Discussion in 'Standard Support' started by dee, Mar 5, 2012.

  1. dee Member

    Level: Community
    hi. what i am trying to accomplish:

    i have a table-view, linked to a menu (Menu1), showing all the data inside that table (table1)

    i want on a different menu (Menu2), to show only certain data of the same table (table1) and the user has the possibility to filter those data by one of the elements (Date).

    i copied "table1" and now i have "table2", which is basicallly identical to table 1, except that i unlinked element "Date" and set-up a filter of type "dropdown" in "table-settings"

    so far so good!

    now, when someone clicks on "Menu2", he should see the data filtered by the last added date in "Date" = i mean, "Date"-dropdown should have as default already selected the last date and not showing "Please select" at all (which is the first entry in the dropdown, but strangely the second one is "empty" and the third one is the first date ??? )

    is this possible?
  2. dee Member

    Level: Community
    "friendly bump"
  3. juuser Member

    Level: Standard
    I would also love to have a solution for this :rolleyes:
  4. myfatebiz Member

    Level: Community
    U need make 2 table view, 2 form ( just using main form only for key in data ), and 2 group with sharing 1 database.

    Menu 1 for table view 1 and menu 2 for table view 2. Remember this table view 1 and 2 is sharing 1 database.
  5. dee Member

    Level: Community
    i think i did that. upon creating the 2nd table view, the 2nd form and group was automatically created. and yes both are sharing the same database-table!

    the problem is:
    1. i need to have the first entry as a default and not "Please select"
    2. there is an empty entry on option no. 2. see what i mean:

    <select maxlength="19" size="1" class="inputbox fabrik_filter" id="geonet_sendungen___Tagesabschluss_filter_range_0" name="fabrik___filter[table_8][value][0]">
    <option selected="selected" value="">Please select</option>
    <option selected="selected" value=""></option>
    <option value="2012-02-20">2012-02-20</option>
    <option value="2012-03-04">2012-03-04</option>
    </select>

    i need this to be like that:

    <select maxlength="19" size="1" class="inputbox fabrik_filter" id="geonet_sendungen___Tagesabschluss_filter_range_0" name="fabrik___filter[table_8][value][0]">
    <option selected="selected" value="2012-02-20">2012-02-20</option>
    <option value="2012-03-04">2012-03-04</option>
    </select>

    ...and ideally already filtering the selected first entry onLoad
  6. dee Member

    Level: Community
    obviously i could solve (1) with JS (if there is no standart fabrik-option), but what is with (2)? is it a bug?
  7. myfatebiz Member

    Level: Community
    Actually i really confuse but i try to understand. Your problem is at table view only right. It mean 2 table view with different data view on database sharing. But your main problem is about filtering on 2nd table view which is menu 2.

    Here i post some example picture but i not sure that is what u want.

    Form A :

    Form A.jpg

    Table View A 1 ( Menu 1 ) which is show all database.

    Table View A 1.jpg

    Table View A 2 ( Menu 2 ) which is show a few database.

    Table View A 2.jpg

    P/S : If i'm misunderstanding just ignore this. And maybe u should put a some picture of your problem for easy us to understand.
  8. dee Member

    Level: Community
    again. very easy:

    dropdown shows:

    - Please select
    - "empty"
    - 2012-03-02
    - 2012-02-01
    - 2012-01-28

    i want it to show

    - 2012-03-02
    - 2012-02-01
    - 2012-01-28

    to be more precise:
    no "Please select"
    and
    no "empty" entry
  9. rob Administrator

    Level: Community
    for the empty option, would you perhaps have entries in the database with null or no values recorded?

    If the date you want to show is always the same you could use a url filter to set that. E.g rather than setting a menu link to the list, create a url link. For info on how to filter the table via the querystring see this wiki page:
    http://fabrikar.com/wiki/index.php/Filtering_tables
  10. dee Member

    Level: Community
    hi rob and thanks for answering!

    on the "empty" issue, you were right. i had a look with phpmyadmin and there was an old entry still in there...

    the date i want to show is not always the same...

    so far i accomplished the following:

    1. the element appearing as a filter contains a date with the following settings:
    OPTIONS
    Hidden: YES
    Default: "empty"
    Store Date As: UTC
    Table date format: %Y-%m-%d %H:%M:%S
    Form date format: %Y-%m-%d
    default to current date: NO
    Always return todays date: NO

    TABLE SETTINGS
    Filter type: Dropdown
    Exact match: NO
    ...the rest is all set to NO...
    Filter data: DEFAULT
    Order by: value

    2. in TABLES i used in FILTERS
    Show Filters: YES
    ...the rest is all set to NO...
    Filter data: Default
    Ajax filter/nav: YES

    and in PLUGINS "JAVASCRIPT" with the contents of the js-file:
    HTML:
    window.addEvent('load', function()
        {
            var el = $('geonet_sendungen___Tagesabschluss_filter_range_0');
            el.getChildren()[0].dispose();
            el.fireEvent('change', new Event.Mock(el, 'change'));
        }
    );
    (strange enough, the own onDomready:function(e){ was not working??? the others though did...)

    ...with the DISPOSE line i get rid of "Please select" (is there really no easier solution?)
    ...and with the FIREEVENT line i let the filter recalculate on the first item that is now visible when someone visits this page

    the trouble is:
    on the dropdown, the two entries available appear:
    <option value="2012-03-09 13:11:54">2012-03-09 13:11:54</option>
    <option value="2012-03-09 13:16:27">2012-03-09 13:16:27</option

    QUESTION1:
    how do i achieve sorting this in a way that the most current date is first?

    QUESTION2:
    when the CHANGE-EVENT fires (automatically or manually) and the first entry is selected, it shows me all contents of the table FROM that date to NOW... but i need: ONLY THE CONTENTS OF THAT DATE!!!

    any idea how to achieve this?
  11. dee Member

    Level: Community
    "friendly bump" ;D
  12. rob Administrator

    Level: Community
    Im suprised it works on 'load' as the dom is not fully loaded, did you really try:

    Code (text):

    window.addEvent('domready'......
     
    and find it not to work?

    re removing the please select - no these no switch in fabrik to remove that - generally filters are not always required so a please select makes sense.

    question 1: as things stand you would have to do that with some javascript I think:

    Code (text):
    [FONT=monospace]
    [/FONT]var el = $('geonet_sendungen___Tagesabschluss_filter_range_0');
    var opts = el.getChildren();
    var newopts = [];
    opts.each(function(opt) {
     newopts.push(opt.value);
    });
    newopts.sort();
    newopts.reverse();
    el.empty();
    for (var i = 0; i < newopts.length; i++) {
     el.adopt(new Element('option', {value: newopts[i]}).set('text', newopts[i]));
    }
     
    Question 2 - try setting the element filter to exact?
  13. dee Member

    Level: Community
    "domready" was not working so i changed it to "load"

    question1 on sorting: will try then with JS, thanks.

    question2 on filter: had tried EXACT as well and there was no difference... then i switched to it to NO. now i changed it back to yes and tested. still, it shows me all entries from the selected date up to now!
  14. dee Member

    Level: Community
    could it be this does not work with exact, because the table view i am showing (table "Tagesabschluesse") is a duplicate of table "Sendungen".

    in the element "Tagesabschluss" of table "Tagesabschluesse", with the dropdown-filter the setting is to EXACT:YES
    but
    in the element "Tagesabschluss" of table "Sendungen" it is set to Filter-Type NONE

    could it be that there is a conflict?
  15. rob Administrator

    Level: Community
    not sure if theres a conflict, you can see the query produced by turning on fabrik debug in Fabrik's global configration page, and then appending '&fabrikdebug=1' to your url.
    this will output some debug information, part of which will be the query that is used to build the list.
  16. dee Member

    Level: Community
    this is the "filter:getColumnData query":
    for selecting 2012-03-09 13:11:54
    ... WHERE ( `jos_users`.`id` = '63' AND `geonet_sendungen`.`id` IN (SELECT id from `geonet_sendungen` WHERE `Tagesabschluss` > '0000-00-00')
    and
    for selecting 2012-03-09 13:16:27
    ... WHERE ( `jos_users`.`id` = '63' AND `geonet_sendungen`.`id` IN (SELECT id from `geonet_sendungen` WHERE `Tagesabschluss` > '0000-00-00')

    ...which is the same and which in my eyes is wrong...
    shouldnt there be something like:
    `Tagesabschluss` = '2012-03-09 13:11:54' ???

    the strange thing is, for the first selection, it returns all data in the table
    for the second one only the ones with the selected date...? even though the query is identical ??? it does not make any sense at all...

    i need to get this fixed by monday, as i have to give the project for testing to the client. could you please have a closer look to this? and maybe add the &fabrikdebug=1 yourself and see it live? i did sent you all data needed a week ago (PM)...

    thanks in advance!
  17. dee Member

    Level: Community
    "friendly bump"
  18. dee Member

    Level: Community
    "friendly bump"

    so client is testing now since monday, it all works so far, except this issue. any chanche we can get this done together? or any feedback like "we are currently looking into it" or "we will do so till (for example) tomorrow"?

    maybe we also could find a totaly different way to achieve the same feature needed, which again in short is:

    showing a certain table (which has 2 date fields, dateA + dateB and is a duplicate of another table), and filtering this table only by dateB (which shows DATE+TIME), in order to show ONLY the entries which have EXACT the DATETIME selected from the dropdown, and nothing else...

    further infos (if of interest):
    the dateB element has
    table date format: %Y-%m-%d %H:%M:%S
    stored as UTC
    is HIDDEN (because in the form it should not be possible to be changed)
    in Table settings it has "show in table" enabled
    and is basically an unlinked element of a duplicate table
  19. dee Member

    Level: Community
    anybody?

    "friendly bump" ???
    a week and no reply...
    is it too complicated or am i being just ignored?
  20. dee Member

    Level: Community
    anybody???

Share This Page