If I understand documentation, to use Livetable with multiple Class (with 3 or 4 common
properties: same name) I must use
Parameter $options:
resultPage The full name of the page to use as a JSON data provider for the table. This
option allows to use a different data source than the default one (XWiki.LiveTableResults)
for specific needs not handled by LiveTableResults (for example: complex cross-classes
queries, external data retrieved with a groovy script, etc.).
with an HQL query like this one (for 2 class: FormSMQ.EAClass and FormSMQ.PiacJ2Class ):
#set($hqlstatement=", BaseObject as obj where (doc.fullName = obj.name and
obj.className = 'FormSMQ.EAClass') or (doc.fullName = obj.name and obj.className =
'FormSMQ.PiacJ2Class')")
$services.query.hql($hqlstatement).execute()
(
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module)
My query list all documents with my 2 Class. To provide JSON source of LiveTable, I must
displayed all my column.
Can I do it with query in one (or two) shots or I must use a foreach loop to rendering my
JSON data?
Thxs
--------------------------------------------
En date de : Mer 25.2.15, Pascal BASTIEN <pbasnews-xwiki(a)yahoo.fr> a écrit :
Objet: [xwiki-users] livetable with multiple class?
À: "XWiki Users" <users(a)xwiki.org>
Date: Mercredi 25 février 2015, 16h20
Hello,
Livetable is somehow magic but ... (there are always a
'but') is it possible to use multiple Class?
I read XWiki.LiveTableResultsMacros
"#macro(gridresultwithfilter_buildQuery $className ...
#set($class =
$xwiki.getDocument($className).getxWikiClass())"
=> livetable use getxWikiClass method (and not
getxWikiClasses :-( )
Here my problem in my nice xwiki 6.4.0 application:
I created some Class/Sheet/Template with 2 common
properties/field: I mean on each document Class I created
this common property (same name, same source): this one by
example
- Name:P1_DgMoa_req Type: Database List
- XWiki Class Name: FormSMQ.ListeDGClass
- Id Field: Name DGId
- Value Field: Name DGLib
On my WebHome I paste this livetable:
#set ($columnsProperties = {
'TypeFiche_RO': {"type":"list","size":10},
'P1_DgMoa_req': {"type":"list","size":10},
'doc.name':
{"type":"text","size":10,"link":"view"},
'doc.date': {"type":"text","size":10},
'doc.creator':
{"type":"text","size":10,"link":"creator"},
'_actions':
{"sortable":false,"filterable":false,"html":true,"actions":["edit"]}
})
#set ($options = {
'className': 'MySpace.MyClass',
'translationPrefix' : 'FormSMQ.livetable.',
'tagCloud': true,
'rowCount': 15,
'maxPages': 10,
'selectedColumn': 'doc.name',
'defaultOrder': 'asc',
'extraParams': "&space=${doc.space}"
})
With one class ( 'className': 'MySpace.MyClass',) my
livetable work perfectly but display only documents 'linked'
with this class (doc with 'MySpace.MyClass' object)
If I use 'className': '' (empty), livetable show all
document on the space but my select list are not filled.
I tried 'TypeFiche_RO':
{"type":"list","size":10,'class':
'MySpace.MyClass' } with
empty 'classname', but if I select a value in my select
list, only document 'linked' with this class are
displayed.
I tried topFilters options (HTML fragment
that will be placed in a "top filter" area in the same
fashion as the Tag Cloud filter) 'topFilters': '<input
type="text" size="15" name="doc.name"
value="">', but no
document will displayed. I didn't managed either (I don't
know how to choose the field who is filtered by the new
input tag)
I don't know if someone understand my problem ( livetable
with multiple class source), but every magics tricks are
welcome to help me.
Thxs.
Pascal B
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users