Ajaxfrancelabs is deprecated as of Datafari v6.0 aside from specific admin and search expert functionalities. Please refer to DatafariUI for any search UI related task.

Available from Datafari 4.4.0

The tab widget adds tabs on top of the results in the search view, between which a user can switch to either filter the results or being redirected to pre configured links.

The tab widget can be initialized in the DATAFARI_HOME/tomcat/webapps/Datafari/js/search.js like this:

Manager.addWidget(new AjaxFranceLabs.TabWidget({
     id : 'tabwidget',
     elm : $("#facet_tabs"),
     field : "repo_source",
     rawTabs : [ {
     "label" : "Test",
     "href" : "http://www.francelabs.com"
     }, {
     "label" : "Test2",
     "href" : "http://www.google.com"
     } ],
     actifValue : "Test",
     container: "#tabs-container",
     showEmpty: true
}));

Here is the description of the available parameters : 

Example : 

[
  {
     "label" : "Test",
     "href" : "http://www.francelabs.com",
     "keepURLParams" : true
  }, 
  {
     "label" : "Test2",
     "href" : "http://www.google.com"
  } 
]

The Tab widget is designed to either use the field parameter or the rawTabs parameter but not both at the same time. So we strongly advise you to be careful with the widget initialization as it may result in strange widget behavior !

Here is an illustration of a widget tab configured with the field parameter : 

And the corresponding configuration in the search.js file :

Manager.addWidget(new AjaxFranceLabs.TabWidget({
     id : 'tabwidget',
     elm : $("#facet_tabs"),
     field : "extension"
     container: "#tabs-container",
}));

It is possible to show results with 0 entries. To do so, you need to configure your solr field so that the facet.mincount is 0, below is an exemple for the repo_source field that you would need to add to your solrconfig.xml:

<int name="f.repo_source.facet.mincount">0</int>

You will need to follow the procedure to update your solr config to be able to add the above and make it available after the deployment of Datafari.

Then, if you want the "All" tab to also display when there are 0 results, you will need to add the parameter showEmpty: true to the widget instanciation like shown below:

Manager.addWidget(new AjaxFranceLabs.TabWidget({
    id : 'tabwidget2',
    container: "#tabs-container",
    elm : $("#facet_tabs2"),
    container: "#tabs-container",
    field: "repo_source",
    showEmpty: true
}));

Here is an illustration of a widget tab configured with the rawTabs parameter : 

And the corresponding configuration in the search.js file :

Manager.addWidget(new AjaxFranceLabs.TabWidget({
     id : 'tabwidget',
     elm : $("#facet_tabs"),
     rawTabs : [ {
     "label" : "Test",
     "href" : "http://www.francelabs.com"
     }, {
     "label" : "Test2",
     "href" : "http://www.google.com"
     } ],
     actifValue : "Test"
}));