Help talk:Datatables format

From semantic-mediawiki.org
Jump to: navigation, search

Contents

Thread titleRepliesLast modified
In-table search issue617:11, 16 April 2017
Sorting and filtering properties of type::date615:48, 10 September 2015
Show entries217:49, 23 June 2015
How to get thumbnails into result datatable?112:06, 10 March 2015
Render wiki links in property fields with type text?117:22, 5 February 2015
Support template?101:45, 2 December 2013
Default sorting211:46, 16 September 2013

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

Loman87 (talk)16: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.

[[kgh]] (talk)00:02, 30 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.

MWJames (talk)12: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,

Loman87 (talk)19: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.

MWJames (talk)14:19, 2 April 2017

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

Loman87 (talk)19: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

MWJames (talk)17: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.

Carchaias (talk)18:41, 20 January 2015

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

Thank you in advance

Michael

MichaelZ70 (talk)09:51, 16 March 2015

You would have to implement such functionality.

MWJames (talk)14:50, 16 March 2015

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

Thanks Michael

MichaelZ70 (talk)15: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

MWJames (talk)18: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?

MichaelZ70 (talk)12: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.

Amhendler (talk)15:48, 10 September 2015
 
 

Show entries

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

Qiubov (talk)15:29, 19 May 2014

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

Krabina Bernhard (talk)12: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

MWJames (talk)17:49, 23 June 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!

Sochin67 (talk)00:02, 18 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.

Grerika (talk)12: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?

Darenwelsh (talk)17: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.

MWJames (talk)17: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.

D3mon187 (talk)21: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

MWJames (talk)01:45, 2 December 2013
 

Default sorting

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

Kaboomki (talk)16: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

MWJames (talk)16: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

Kaboomki (talk)11:46, 16 September 2013