Help talk:Datatables format redirect

From semantic-mediawiki.org

Contents

Thread titleRepliesLast modified
default number of results to display414:39, 28 August 2023
Open link in a new tab412:53, 4 February 2020
Boolean Type Formatter not working with Datatables (2.4.2)114:12, 14 November 2018
RFE: support records and reference type114:10, 14 November 2018
Result limit207:42, 6 June 2017
Show entries423:20, 5 June 2017
In-table search issue616:11, 16 April 2017
Sorting and filtering properties of type::date614:48, 10 September 2015
How to get thumbnails into result datatable?111:06, 10 March 2015
Render wiki links in property fields with type text?116:22, 5 February 2015
Support template?100:45, 2 December 2013
Default sorting210:46, 16 September 2013

default number of results to display

I have $smwgQMaxInlineLimit = 3000 and $smwgQMaxLimit = 3000 and

{{#ask: ...
 |format=datatable
 |limit=1000
}} 

The default number of pages displayed is always 10. How can I increase this number?

I think the "limit" parameter may actually be doing its job in terms of data, because if I lower it and then search for a person who would show up later, they don't show, but if I increase the limit the search finds them. So it's not that the limit parameter doesn't work, it simply no longer does what I would intuitively expect it to do. Is there a different parameter or CSS trick to increase the default, or is it simply not configurable?

22:53, 23 February 2019

> The default number of pages displayed is always 10. How can I increase this number?

I suspect you mean the dropdown which says 10, selecting a different number should modify the list length. If you mean to have a different default (other than 10) then you would need to look at [0] and modify the source [1] accordingly.

[0] https://datatables.net/examples/advanced_init/length_menu.html

[1] https://github.com/SemanticMediaWiki/SemanticResultFormats/blob/master/formats/datatables/resources/ext.srf.formats.datatables.js

23:08, 23 February 2019

Thanks MWJames, and sorry about the long delay. Do I read your suggestion right that I should update the ResultFormats source code according to the documentation from the datatables people? This would mean having to do this change every time I update SRF (or learn how to make the update good enough it becomes part of SRF :-) ). Just to be sure I am not missing something... Thanks!

05:42, 24 April 2019

Did you figure it out? You're probably not going to reply. It saddens me that a feature that has been requested this many times has not been implemented.

08:54, 19 February 2022

FWIW: in the current version of Datatables (SMW 4.1 onwards), you can use:

|datatables-pageLength=50
14:39, 28 August 2023
 
 
 
 

Open link in a new tab

Hi, I am facing this problem: when a user open an internal link listed in a datatable and then he comes back to page containing the datatable (both using 'go back' or a link to the original datatable), filters and sorting that he chose before are lost, so he has to make his query again. To avoid this, I was thinking if there is a way to open the links listed in a datatable in a new tab. I read this, but seems to work just with wikitext. Any other ideas? Thanks, Lorenzo

09:04, 23 May 2018

Interesting question to which I do not have an answer. You might want to post to one of the mailing lists.

15:42, 24 May 2018
 

A possible solution comes to my mind now: Have a look at the "LinkTarget" extension that I think will be able to help you here since datatables has a class of it's own (srf-datatables) you can work on.

22:55, 14 December 2018

Thanks, I'll give it a try!

14:18, 17 December 2018

I did some tests using the extension but with no success. I tried also this snippet source:

$( function () {
     $( '#mw-content-text' ).on( 'click', '.srf-datatables > a', function () {
       var otherWindow = window.open();
       otherWindow.opener = null;
       otherWindow.location = this;
        return false;
  } );
} );

It seems to work better (using classes as attributes in <span>); anyway using srf-datatables (and also the newer smw-datatable) nothing changes, links are always open in the same tab.
I don't know if I am doing something wrong or simply this cannot be achieved.
Thanks for your help anyway!
Lorenzo

12:53, 4 February 2020
 
 
 

Boolean Type Formatter not working with Datatables (2.4.2)

Hi,

I am using Datatypes extensively on one of my projects. I've noticed that the boolean type formatter does not work with datatables. Is there a reason for this? Am I using an outdated version (2.4.2)? I checked the changelog, but couldn't find any support since for boolean formatting. Also, is it easy to integrate? Any help would be very appreciated, as currently I'm using a script to replace the f/t-s with yes/no values.

Thanks in advance for any help.

08:53, 14 November 2018

From experience with this result format I am pretty sure that these formatters are not supported. I am not sure if it will be easier or not to add support. However I guess it is worth adding a feature request on GitHub.

14:12, 14 November 2018
 

RFE: support records and reference type

@mwjames you have done an excellent work and it is a pity not to support the 'reference' type or the records which is quite handy for certain occasions. I would like to ask if there is a possibility to support it in the foreseeable future? Is there some blocker (e.g. API not supporting records)?

04:04, 9 October 2018

This is probably something to add here as a feature request. However do not hold your breath.

14:10, 14 November 2018
 

Result limit

Hi, sorry to bother you again.
I have an issue about the results shown in a datable. Using #ask, the table returns 500 entries by default, no matter how I set the parameter 'limit'; however if I click on the refresh button of the table, all the results are shown. Is there any way to solve this issue? It is very annoying because if a user doesn't refresh the table, he/she can't perform a full search of the data.
Thanks for your help,

10:58, 5 June 2017

Most probably you are writing about more than 500 results to be shown. Have a look at configuration parameter $smwgQMaxInlineLimitSets the maximal number of rows ever printed by queries. Also have a look at the user preferences which allow you to control the behaviour for refreshing.

23:19, 5 June 2017

Wonderful! Now it's working fine. Thanks a lot, Lorenzo

07:42, 6 June 2017
 
 

Show entries

Is it possible to change the default number of entries on a page from 10 to another number? Thanks

14:29, 19 May 2014

I would need that, too! Should be configurable by an extra parameter.

11:31, 10 June 2015

Please have a look at [0] which is currently not implemented but we welcome pull requests.

[0] https://datatables.net/reference/option/pageLength

16:49, 23 June 2015

Any update about this?
Thanks,

10:59, 5 June 2017

No, I am afraid that nobody came up with a pull request on this yet.

23:20, 5 June 2017
 
 
 
 

In-table search issue

Hi, I have an issue about the datatables default search: when I digit 'a' it doesn't show rows with 'à' (the same happens with other letters with accents). I hope I have been clear in describing the issue. Do you think s there any solution to this problem? Thanks for your help, Lorenzo

15:31, 29 March 2017

Yeah, I understand what you mean. I believe that this is an enhancement that should be reported. Probably some regex foo is required to make it understand these chars without accents.

23:02, 29 March 2017
 

SMW only provides the "raw" data to the datatables plug-in [0] and any functionality provided by that plug-in (including the in-search functionality) is a matter of that plug-in.

As for the search of accents, [1, 2] elaborates a bit more on the search and how to solve a potential issue.

11:43, 1 April 2017

Thanks for the answers!
I must confess: I am quite a dummy in this stuff so I have to ask for your help and patience. I read the links you gave me but I didn't understand a lot actually :(
I gave a look to ext.srf.format.datables.js in the SRF folder but I can't find anything similar to the code described in the discussions you listed. Could you give me some other hints, please? Thanks again,

18:33, 1 April 2017

> I gave a look to ext.srf.format.datables.js

ext.srf.format.datables.js is part of SMW and only responsible for communicating with the datatables plug-in [0]. Content of [0] is maintained by [1] therefore generally we don't manipulate those files or its inner workings.

13:19, 2 April 2017

Thanks for the explanation. So there is no easy way to solve this issue, am I correct?
Thanks again, Lorenzo

18:11, 5 April 2017

There will be a feature coming with 3.0 to support in-table search [0, 1]. [1] can be used as a starting point to fix the SRF:DataTables.

[0] https://sandbox.semantic-mediawiki.org/wiki/Issue/2420

[1] https://sandbox.semantic-mediawiki.org/wiki/Discussion:French_accents

16:11, 16 April 2017
 
 
 
 
 

Sorting and filtering properties of type::date

The table is not sorted correct if the property that has type::date. Sorting by click on the headline in this case is alphabetical instead of numerical.

Filtering the table does not work for property that has type::date. Filtering ist alphabetical instead of numerical. Example: Filtering for "6 Januar 2015" shows "16 Januar 2015" and "26 Januar 2015" results aditional.

17:41, 20 January 2015

I have the same Problem. Does anyone knows a solution or a workaround?

Thank you in advance

Michael

08:51, 16 March 2015

You would have to implement such functionality.

13:50, 16 March 2015

And do you know where and how to do it? ;)

Thanks Michael

14:48, 16 March 2015

[0] contains some old/early notes about how sorting can be implemented which certainly needs adaptation but should give a hint as to where to look.

[0] https://gist.github.com/mwjames/3db73525b08a5f0e113e

17:31, 16 March 2015

I still to find a way to implement sorting for values of datatyp DATE. I looked at your sample but did manage to implement it. Maybe someone else found a solution for this?

11:22, 19 March 2015
 
 
 

I have not fully tested this, but in my data, it seems like fields where each value is set, the dates are sorted properly (I have also found it helpful to set times, as dates seem to be calculated for this format based on the server's time zone, regardless of user settings). If there are any blank values in any of the results, they will not sort properly.

For example, if I have two columns with date values, one of which has a value for each date, and one of which is blank, the column with all values set will sort properly, but the column with some blank values set will sort alphabetically (e.g., 1, 12, 2, then alphabetical month).

Filtering will not fix this; the underlying query has to return results with values set for each result in the relevant column for chronological sorting to work.

14:48, 10 September 2015
 
 

How to get thumbnails into result datatable?

I am runing a german Wiki and so far I wasn't able to get thumbnails into the result datatable.

My query looks like this:

{{#ask: [[Kategorie:Archivalien]] | mainlabel=Titel | ?Bild | ?Signatur | ?Archivierungsart | ?Laufzeit | ?Quelle | ?Aufbewahrung der Originale | format=datatables | link=all | headers=show }}

All result data from the semantic attributes "Signatur", "Archivierungsart", "Laufzeit", "Quelle" and "Aufbewahrung der Originale" are listed correctly in the datatable. However, the attribute "Bild" contains the file name of a related picture (e.g. "hvg28.jpg") and I would like to have a thumbnail of that picture in the corresponding column of the result datatable. This is what does not work. What am I doing wrong? What are the requirements to get thumbnails into the result datatable?

Many thanks for any help!

23:02, 17 July 2014

I am not sure it help after 6 months, but I may have a solution. In my wiki every page which has image has the property [[Has image::Image.jpg]] and when I just asked in the query ?Has image=Bild it shows the picture without any other hacking.

11:05, 10 March 2015
 

Render wiki links in property fields with type text?

I see under the Limitations section that "Common wiki markup, such as that for italic or bold, is often not rendered by the datatables format." Does this include basic wiki links? I have a property of type Text and some of the values include basic wiki links. Those are not being rendered, but instead display all the double brackets. Is there a way to render these as wiki links?

16:06, 5 February 2015

> as that for italic or bold, is often not rendered by the datatables format." Does this include basic wiki links?

The datatables format is to facilitate the query-API, which means any extra parsing has to be implemented on top if it. I can't remember but I think the JSON output does not render HTML and instead uses the wikitext source to be deployed to a client which means you have to render those links after it has been received by the client (in JS).

I personally don't have time to look at those things but anyone is welcome to send patches to the SRF repo to be reviewed.

16:21, 5 February 2015
 

Support template?

Does the datatables format support templates? I love the features of the new format, but need to change the way it's displayed and how data is linked, like can be done with the listwidget format.

20:12, 30 November 2013

Feel free to add such feature, personally I have not planned to extend the current functionality.

If you do extend the format, please be aware that this format communicates solely through the SMW Api which means that any additional parsing/formatting has to use the MW Api [1].

[1] https://www.mediawiki.org/wiki/API:Parsing_wikitext#expandtemplates

00:45, 2 December 2013
 

Default sorting

Hi, is there any way to achieve a default sorting of the tables (according so SMW "sort" parameter)?

15:17, 22 August 2013

No that's not possible right now because the QueryApi doesn't serialize [1] the information necessary so that DataTables could act upon.

[1] https://gerrit.wikimedia.org/r/#/c/52422

15:31, 22 August 2013

Thanks! And is it possible to rise the default limit for entries that are queried in the background? Just changing "$smwgQDefaultLimit" or rising the limit in the #ask query didn't help. Its not very comfortable for usere if they have to manually change the limit parameter in the interface to access a more comprehensive amount of content.

Best

10:46, 16 September 2013