Last modified by Michael Hamann on 2021/10/18

<
From version < 117.2 >
edited by Michael Hamann
on 2021/10/07
To version < 117.3 >
edited by Michael Hamann
on 2021/10/07
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -2,6 +2,10 @@
2 2  {{toc/}}
3 3  {{/box}}
4 4  
5 +{{info}}
6 +This page is a draft for [[Creating a FAQ Application (Manual) >> Documentation.DevGuide.Tutorials.FAQTutorial.FAQTutorialManual]]. The rework should be completed until 2021-10-08.
7 +{{/info}}
8 +
5 5  This tutorial will show you how to build a Frequently Asked Questions (FAQs) [[Application>>platform:Features.Applications]] much like the one you can find on the [[FAQ page>>FAQ.WebHome]]. This is a very simple application that makes use of XWiki's [[classes, properties, and objects>>platform:DevGuide.DataModel||anchor="HXWikiClasses2CObjects2CandProperties"]]. It also uses a technique that you may frequently use as the basis for several different kinds of applications.
6 6  
7 7  {{info}}
... ... @@ -315,6 +315,53 @@
315 315  
316 316  {{image reference="FAQsLivetableWithTranslations.png"/}}
317 317  
322 +=== Using Live Data ===
323 +
324 +{{version since='13.0RC1'}}
325 +The [[Live Data Macro>>extensions:Extension.Livetable Macro]] is a modern replacement of Livetable components that is more flexible. It can use the same "liveTable" data source and thus display the same data. However, the way it is configured is bit different. Apart from some parameters that can be directly supplied to the macro, it supports a JSON content that can contain further, more detailed configuration options. Here we configure it similar to the options above. We have:
326 +
327 +* The id, here explicitly chosen to be different from the one above to ensure they are unique if both are on the same page
328 +* The columns (properties) to display, here the question, creation date and the actions
329 +* The data source, this should be ##liveTable##
330 +* The source parameters, here specifying the class of objects to display and the translation prefix
331 +* In the extended metadata, we only configure the displayer for the question and specify that the ##link##-displayer should be used, linking to the view action and enabling HTML content such that the HTML code of the question is not escaped but displayed.
332 +
333 +The resulting code is:
334 +
335 +{{code language="none"}}
336 +{{liveData
337 + id="faqLD"
338 + properties="question, doc.creationDate, _actions"
339 + source="liveTable"
340 + sourceParameters="className=FAQ.FAQClass&translationPrefix=faq."
341 +}}{
342 + "meta": {
343 + "propertyDescriptors": [
344 + {
345 + "id": "question",
346 + "displayer":
347 + {
348 + "id": "link",
349 + "linkType": "view",
350 + "html": true
351 + }
352 + }
353 + ]
354 + }
355 +}{{/liveData}}
356 +{{/code}}
357 +
358 +* Copy this code and paste it as Wiki content (inside ##FAQ.WebHome##)
359 +* Click "Save and View"
360 +* Unless you already created the translations for the Livetable in the section above, you also need to create the translations page as described there
361 +* New FAQ entries will now be displayed on the page once you create them
362 +
363 +The ##FAQ.WebHome## page should look similar to this (after creating the translations):
364 +
365 +{{image reference="FAQsLiveData.png"/}}
366 +
367 +{{/version}}
368 +
318 318  === Using custom code ===
319 319  
320 320  You will need to write the following code:

Get Connected