The special pages in this extension do not currently work in MW 1.42. A trivial change that fixes this is available in DataTable2TablesPager: Fix getQueryInfo() to use Wikimedia\Rdbms\Subquery. Could someone kindly review this change?
Extension talk:DataTable2/Flow
Appearance
When use dt2-showtable tag in template page, the variables in template could not convert to value.
In the old discussion, I found out that datatable2 tag cannot be used to store data in template. I think it's right.However, it may be work for dt2-showtable tag use in template. Such as add:
$args['where']=$parser->replaceVariables($args['where'], $frame, true )
in '''renderShowTable''' to convert '''where''', '''order-by'''. Is this suitable?
You can use the #tag magic word to achieve this.
Thanks! I try to use #tag magic word for dt2-showtable in template, it work!
I try to use for datatable2 also, even if not set variable, such as: {{#tag:datatable2|{{FULLPAGENAME}};interesting page;extension description|table=demo1|class=wikitable|columns=page{{!}}rating{{!}}type|fs=;}}, it can show but no data store to data table, so it only work for show table?
Yes, by the way MW works, data can be stored with the tag itself only.
I tried to put a very long paragraph of sentences in a data table and it appears to be truncated at 255 characters. Is this a fixed limit? Is there any way to have longer lengths?
@RV1971 just wanted to ping you so you see this. Thanks for your hard work on this extension! Please see my question above when you have a moment to reply. Thanks!
Indeed this limit is hard-wired in the table definition, see datatable2_data.sql. You can change it by modifying the SQL file before installing the extension. If you have already installed it, you can still modify the table in your database. In case you don't know how to do this, look for ALTER TABLE in the documentation of your underlying database system.
That was what I thought. I was about to change the table definition using my hosting provider's phpmyadmin web interface but was concerned that it may lead to other issues. I looked over your code via github and I can't see any reason why it wouldn't work, but just wanted to pick your brain on it before I tried it and broke something. I'm gonna up it to 1023 I think. Thanks for the help!
That limit might be worth mentioning in the extension documentation.
Good idea. I have just done so, thanks!
Deprecated: Use of Revision::__construct was deprecated in MediaWiki 1.31. [Called from MediaWiki\Storage\PageUpdater::doModify in /var/www/html/includes/Storage/PageUpdater.php at line 1252] in /var/www/html/includes/debug/MWDebug.php on line 376 Deprecated: Use of NewRevisionFromEditComplete hook (used in onNewRevisionFromEditComplete) was deprecated in MediaWiki 1.35. [Called from MediaWiki\HookContainer\HookContainer::run in /var/www/html/includes/HookContainer/HookContainer.php at line 137] in /var/www/html/includes/debug/MWDebug.php on line 376 Deprecated: Use of Revision::getContent was deprecated in MediaWiki 1.31. [Called from DataTable2::onNewRevisionFromEditComplete in /var/www/html/extensions/DataTable2/includes/DataTable2.php at line 260] in /var/www/html/includes/debug/MWDebug.php on line 376
I downloaded the version after selecting the 1.36 MW version.
I have just updated my MediaWiki to 1.37 and pushed a fix for DataTable2 so that it now works with 1.37. So you might try upgrading to 1.37.
I'm loading DataTable2 after Scribunto, both extensions show up in the versions page, mw.ext.ParserFunctions does exist.
I think this has to do with the check
if ( isset( $wgExtensionCredits['parserhook']['Scribunto'] ) ) {
wgExtensionCredits doesn't appear in the Scribunto code
I have been playing with this extension trying to use it with the template in an external page, and then passing the template name as an argument. My problem is that I would also like to have the header included in the template. Is there a way to include the head definition within the template as well so I can externalize both the head and rows from the call. I would like to do something like:
<dt2-showtable table="Table1" template="Template:Table1 Template" class="wikitable" args="Descriptor=Population" where="State in ('Wisconsin')">
I was hoping that the external template would work similar to the inline template where you can pass a <head> tag so I could do something similar to below as my template but it doesn't seem to be working:
<head>
|-
! rowspan="2" | State || colspan="3" |{{{Descriptor}}} Counts || colspan="3" | Change in # of {{{Descriptor}}}||colspan="3" | % Change in {{{Descriptor}}}
|-
! 2017 || 2018 || 2019 || 2017 to 2018 || 2018 to 2019 || 2017 to 2019 || 2017 to 2018 || 2018 to 2019 || 2017 to 2019
</head>
|-
! {{{Business_Category}}} | {{{CY2017}}} || {{{CY2018}}} || {{{CY2019}}}
| {{{2017_to_2018_delta}}} || {{{2018_to_2019_delta}}} || {{{2017_to_2019_delta}}}
| {{{Percent_Change(2017-2018)}}} || {{{Percent_Change(2018-2019)}}} || {{{Percent_Change(2017-2019)}}}
Am I missing something, or is it not possible to define a <head> within an external template?
Thanks
I'm not sure if I understand what you mean. If I get it right, you'd like to include a template that contains <head>...</head>
. This cannot work because the content in <dt2-showtable>...</dt2-showtable>
is first parsed for things like <head>...</head>
, and then any template substitution takes place. Hope this answers your question.
Hello,
I'm running MediaWiki 1.31.1 on Mac OS and installed the "DataTable2" extension according to the instruction. For testing purposes, I added the code from the "demo table" example into a wikipage and received a fatal exception error of the typ "error".
Could you please be so kind and give advice? Thanks!
I'm afraid I'm still on MediaWiki 1.30.0. I hope to upgrade my installation in the next days. In the meantime, can you give any futher details about the error?
I have just upgraded my MediaWiki to 1.31.1, and everything is working. So I'd need some further details to analyze this. You might take a look at Manual:How to debug.
Thanks for your answer. I have reinstalled my wiki. Now I receive the following error code:
[08a362df8789b85d404df252] /index.php?title=Main_Page&action=submit Error from line 455 of .../Wiki/extensions/DataTable2/includes/DataTable2.php: Call to undefined function wfProfileIn() Backtrace: #0 .../Wiki/includes/parser/Parser.php(3888): DataTable2->renderDataTable(string, array, Parser, PPFrame_DOM) #1 .../Wiki/includes/parser/Preprocessor_DOM.php(1362): Parser->extensionSubstitution(array, PPFrame_DOM) #2 .../Wiki/includes/parser/Parser.php(2942): PPFrame_DOM->expand(DOMElement, integer) #3 .../Wiki/includes/parser/Parser.php(1293): Parser->replaceVariables(string) #4 .../Wiki/includes/parser/Parser.php(443): Parser->internalParse(string) #5 .../Wiki/includes/content/WikitextContent.php(323): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL) #6 .../Wiki/includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, NULL, ParserOptions, boolean, ParserOutput) #7 .../Wiki/includes/page/WikiPage.php(2129): AbstractContent->getParserOutput(Title, NULL, ParserOptions) #8 .../Wiki/includes/page/WikiPage.php(1655): WikiPage->prepareContentForEdit(WikitextContent, NULL, User, string, boolean) #9 .../Wiki/includes/EditPage.php(2214): WikiPage->doEditContent(WikitextContent, string, integer, boolean, User, string, array, integer) #10 .../Wiki/includes/EditPage.php(1506): EditPage->internalAttemptSave(array, boolean) #11 .../Wiki/includes/EditPage.php(652): EditPage->attemptSave(array) #12 .../Wiki/includes/actions/EditAction.php(60): EditPage->edit() #13 .../Wiki/includes/actions/SubmitAction.php(38): EditAction->show() #14 .../Wiki/includes/MediaWiki.php(500): SubmitAction->show() #15 .../Wiki/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title) #16 .../Wiki/includes/MediaWiki.php(861): MediaWiki->performRequest() #17 .../Wiki/includes/MediaWiki.php(524): MediaWiki->main() #18 .../Wiki/index.php(42): MediaWiki->run() #19 {main}
You are using an old version of the extension, the calls to wfProfileIn() have been removed in May 2018. Pls try downloading the current version.
I downloaded the following version "DataTable2-REL1_31-c178d87.tar" via thisLink. My assumption was that I will receive an acutal version. Could you please advice how to proceed? Thanks again for your support!
I'm afraid you're perfectly right! Sorry, I failed to merge the master branch into the REL1_31 branch. I have just done that, so a corrected version should be available soon at that link.
Thanks for uploading the new version. I installed it today and checked its presence under Special:Version. The extension was listed there. However, when I tested the <datatable2>-example code from extension page, the following error was generated: Fatal exception of type "Wikimedia\Rdbms\DBQueryError"
. Any thought on it?
I just realized that in some older edit on #Installation I removed by mistake the information that a database upgrade is needed to install the extension, so I guess you didn't do this. I have just corrected the instructions. Pls run the database upgrade script.
Perfect. It works now. Thanks a lot!
Possible to display textbox or input box on another page, to Add Single Record?
I'm afraid your question is not clear to me. Could you kindly explain more in detail what you'd like to do?
Display an input box on a page.
Type data into the inputbox.
Click Submit button, and a record gets added to a table, containing the data i typed.
Type new data into the inputbox.
Click Submit button, and another record gets added to the table.
DataTable2 works by parsing data from wikipage text. To make your idea work, you'd need an inputbox which inserts a record into the text of a page. I'm afraid I'm not aware of the existence of an inputbox of this kind.
I use Extension:Page Forms to create new pages. Can a new entry be added to a DT2 table by PageForms extension?
~~~~
I'm afraid I do not yet use Semantic MediaWiki, so I cannot tell for sure. I depends on whether Page Forms calls the NewRevisionFromEditComplete hook at the right moment. Just try it and let me know. If it does not work out of the box, perhaps I just need to add some other hook.
i'm using Page Forms without Semantic MW.
I just tried the extension in my MW 1.27.0 installation and when I tried to save my first table, I got an SQL exception. Some googling led me to https://phabricator.wikimedia.org/T120791 which suggests replacing the methods begin()/commit() with startAtomic()/endAtomic() respectively. I replaced them in the DataTable2Database.php file and the extension worked fine (I haven't tested all the features though). I would commit the update myself, but it's hosted at SourceForge where I'm not confortable. Could someone else take care?