Help talk:Datatables format redirect
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
default number of results to display | 4 | 14:39, 28 August 2023 |
Open link in a new tab | 4 | 12:53, 4 February 2020 |
Boolean Type Formatter not working with Datatables (2.4.2) | 1 | 14:12, 14 November 2018 |
RFE: support records and reference type | 1 | 14:10, 14 November 2018 |
Result limit | 2 | 07:42, 6 June 2017 |
Show entries | 4 | 23:20, 5 June 2017 |
In-table search issue | 6 | 16:11, 16 April 2017 |
Sorting and filtering properties of type::date | 6 | 14:48, 10 September 2015 |
How to get thumbnails into result datatable? | 1 | 11:06, 10 March 2015 |
Render wiki links in property fields with type text? | 1 | 16:22, 5 February 2015 |
Support template? | 1 | 00:45, 2 December 2013 |
Default sorting | 2 | 10:46, 16 September 2013 |
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?
> 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
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!
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
Interesting question to which I do not have an answer. You might want to post to one of the mailing lists.
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.
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
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.
@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)?
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,
Most probably you are writing about more than 500 results to be shown. Have a look at configuration parameter $smwgQMaxInlineLimit
Sets 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.
Is it possible to change the default number of entries on a page from 10 to another number? Thanks
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
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.
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.
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,
> 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.
Thanks for the explanation. So there is no easy way to solve this issue, am I correct?
Thanks again,
Lorenzo
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
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.
I have the same Problem. Does anyone knows a solution or a workaround?
Thank you in advance
Michael
You would have to implement such functionality.
And do you know where and how to do it? ;)
Thanks Michael
[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.
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.
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!
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?
> 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.
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.
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
Hi, is there any way to achieve a default sorting of the tables (according so SMW "sort" parameter)?
No that's not possible right now because the QueryApi doesn't serialize [1] the information necessary so that DataTables could act upon.
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