Re: [xwiki-users] Pagination macro with sortable table

2011-01-17 Thread tomasg

Hi, I tried to change code of DeletedDocuments to display my own data from
external mysql db. When I write my own code table does not show data. JSON
results are valid, I tested them on http://www.jsonlint.com/. Number of
total rows are displayed correctly, but there are no data. I tried many
options but still nothing. Could you help me what should be done next? 

Code:

{{velocity}}
#if(!$request.list)
 #set($collist = [mistnost, osoba])
 #set($colprops = {
   mistnost  : { type : text , size : 10 }, 
   osoba  : { type : text , size : 10 }
 })
 #set($options = {
url:http://localhost:8080/xwiki/bin/Sandbox/Test1?list=1xpage=plainoutputSyntax=plain})
 #livetable('mistnosti' $collist $colprops $options)

#else ## request.list

 #includeMacros(Sprava.Macros)
 #connectDbTEP($dbc)

 #if($!{request.get('xpage')} == 'plain')

 ## json starts
 {
 totalrows: 13,
 returnedrows: 10,
 offset: 0,
 rows: [
 #foreach($row in $dbc.executeQuery(select id_room, mistnost, prijmeni,
jmeno from room, osoby where room.id_os = osoby.id_os))
  #set($mistnost = $row.getString(mistnost))
  #set($prijmeni = $row.getString(prijmeni))
  #set($jmeno = $row.getString(jmeno))

   #if($velocityCount  1) , #end
   {
 mistnost  : $mistnost,
 osoba : $prijmeni $jmeno
   }
 #end
 ]}
 #end## xpage=plain

#end## request.list
{{/velocity}}


Thank you
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/Pagination-macro-with-sortable-table-tp5787879p5932246.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Pagination macro with sortable table

2010-12-03 Thread Sergiu Dumitriu
On 11/30/2010 10:39 PM, Tomas Grunt wrote:
 And could I use there data from MySQL db through sql plugin? I have looked
 for this usage but did not find it.

Yes, as long as you provide your custom results page. You can adapt, for 
example, XWiki.AllAttachmentsResults or XWiki.DeletedDocuments.


 2010/11/30 Jerome Velociterjer...@xwiki.com

 Hello tomasg,

 If you want to have dynamic sorting and filtering, you should rather
 use the LiveTable component/macro

 Checkout :
 * http://code.xwiki.org/xwiki/bin/view/Macros/LiveTableMacro
 * http://platform.xwiki.org/xwiki/bin/view/DevGuide/LiveTable

 Cheers,
 Jérôme

 On Tue, Nov 30, 2010 at 1:17 PM, tomasgtomas.gr...@gmail.com  wrote:

 Hello, I would like to know whether is possible refresh table data when I
 change column for sorting.
 Now, when I click to sort by some column, table is sorted with actual
 table
 data, not with all data. I expect that is needed to add order by to sql
 query, but what else should I add?
 If this is not possible could I use livetable with data from sql query?

 Thank you


 Here is my code:

 $xwiki.ssfx.use(js/xwiki/table/table.css)
 $xwiki.jsfx.use(js/xwiki/table/tablefilterNsort.js, true)

 #connectDbTEP($dbc)
 #countRooms($pocetMistnosti)

 #set($paginationParameters = {
 'totalItems' : $pocetMistnosti,
 'defaultItemsPerPage' : 15,
 'url' : $doc.getURL('view', $queryParams)
   })
   #pagination($paginationParameters)

 table  id=searchResults class=grid sortable doOddEven
   tr class=sortHeader
 thMístnost/th
 thZodpovědná osoba/th
 th class=unsortableOperace/th
/tr

#foreach($row in $dbc.executeQuery(select id_room, mistnost, prijmeni,
 jmeno from room, osoby where room.id_os = osoby.id_os limit
 $paginationParameters.firstItem, $paginationParameters.itemsPerPage))
tr
 td  $row.getString(mistnost)/td
 td  $row.getString(prijmeni) $row.getString(jmeno)/td
 td
EditRoom?id_room=$row.getLong(
DeleteRoom?id_room=$row.getLong(
 /td
/tr
#end
/table

   #set($discard = $paginationParameters.put('position', 'bottom'))
   #pagination($paginationParameters)


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Pagination macro with sortable table

2010-11-30 Thread tomasg

Hello, I would like to know whether is possible refresh table data when I
change column for sorting. 
Now, when I click to sort by some column, table is sorted with actual table
data, not with all data. I expect that is needed to add order by to sql
query, but what else should I add? 
If this is not possible could I use livetable with data from sql query? 

Thank you 


Here is my code: 

$xwiki.ssfx.use(js/xwiki/table/table.css) 
$xwiki.jsfx.use(js/xwiki/table/tablefilterNsort.js, true) 

#connectDbTEP($dbc) 
#countRooms($pocetMistnosti) 

#set($paginationParameters = { 
'totalItems' : $pocetMistnosti, 
'defaultItemsPerPage' : 15, 
'url' : $doc.getURL('view', $queryParams) 
  }) 
  #pagination($paginationParameters) 

table  id=searchResults class=grid sortable doOddEven 
  tr class=sortHeader 
thMístnost/th 
thZodpovědná osoba/th 
th class=unsortableOperace/th 
   /tr 

   #foreach($row in $dbc.executeQuery(select id_room, mistnost, prijmeni,
jmeno from room, osoby where room.id_os = osoby.id_os limit
$paginationParameters.firstItem, $paginationParameters.itemsPerPage)) 
   tr 
td $row.getString(mistnost) /td 
td $row.getString(prijmeni) $row.getString(jmeno)/td 
td 
   EditRoom?id_room=$row.getLong(  
   DeleteRoom?id_room=$row.getLong(  
/td 
   /tr 
   #end 
   /table 

  #set($discard = $paginationParameters.put('position', 'bottom')) 
  #pagination($paginationParameters)
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/Pagination-macro-with-sortable-table-tp5787879p5787879.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Pagination macro with sortable table

2010-11-30 Thread Jerome Velociter
Hello tomasg,

If you want to have dynamic sorting and filtering, you should rather
use the LiveTable component/macro

Checkout :
* http://code.xwiki.org/xwiki/bin/view/Macros/LiveTableMacro
* http://platform.xwiki.org/xwiki/bin/view/DevGuide/LiveTable

Cheers,
Jérôme

On Tue, Nov 30, 2010 at 1:17 PM, tomasg tomas.gr...@gmail.com wrote:

 Hello, I would like to know whether is possible refresh table data when I
 change column for sorting.
 Now, when I click to sort by some column, table is sorted with actual table
 data, not with all data. I expect that is needed to add order by to sql
 query, but what else should I add?
 If this is not possible could I use livetable with data from sql query?

 Thank you


 Here is my code:

 $xwiki.ssfx.use(js/xwiki/table/table.css)
 $xwiki.jsfx.use(js/xwiki/table/tablefilterNsort.js, true)

 #connectDbTEP($dbc)
 #countRooms($pocetMistnosti)

 #set($paginationParameters = {
    'totalItems' : $pocetMistnosti,
    'defaultItemsPerPage' : 15,
    'url' : $doc.getURL('view', $queryParams)
  })
  #pagination($paginationParameters)

 table  id=searchResults class=grid sortable doOddEven
  tr class=sortHeader
    thMístnost/th
    thZodpovědná osoba/th
    th class=unsortableOperace/th
   /tr

   #foreach($row in $dbc.executeQuery(select id_room, mistnost, prijmeni,
 jmeno from room, osoby where room.id_os = osoby.id_os limit
 $paginationParameters.firstItem, $paginationParameters.itemsPerPage))
   tr
    td $row.getString(mistnost) /td
    td $row.getString(prijmeni) $row.getString(jmeno)/td
    td
       EditRoom?id_room=$row.getLong(
       DeleteRoom?id_room=$row.getLong(
    /td
   /tr
   #end
   /table

  #set($discard = $paginationParameters.put('position', 'bottom'))
  #pagination($paginationParameters)
 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Pagination-macro-with-sortable-table-tp5787879p5787879.html
 Sent from the XWiki- Users mailing list archive at Nabble.com.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Pagination macro with sortable table

2010-11-30 Thread Tomas Grunt
And could I use there data from MySQL db through sql plugin? I have looked
for this usage but did not find it.

2010/11/30 Jerome Velociter jer...@xwiki.com

 Hello tomasg,

 If you want to have dynamic sorting and filtering, you should rather
 use the LiveTable component/macro

 Checkout :
 * http://code.xwiki.org/xwiki/bin/view/Macros/LiveTableMacro
 * http://platform.xwiki.org/xwiki/bin/view/DevGuide/LiveTable

 Cheers,
 Jérôme

 On Tue, Nov 30, 2010 at 1:17 PM, tomasg tomas.gr...@gmail.com wrote:
 
  Hello, I would like to know whether is possible refresh table data when I
  change column for sorting.
  Now, when I click to sort by some column, table is sorted with actual
 table
  data, not with all data. I expect that is needed to add order by to sql
  query, but what else should I add?
  If this is not possible could I use livetable with data from sql query?
 
  Thank you
 
 
  Here is my code:
 
  $xwiki.ssfx.use(js/xwiki/table/table.css)
  $xwiki.jsfx.use(js/xwiki/table/tablefilterNsort.js, true)
 
  #connectDbTEP($dbc)
  #countRooms($pocetMistnosti)
 
  #set($paginationParameters = {
 'totalItems' : $pocetMistnosti,
 'defaultItemsPerPage' : 15,
 'url' : $doc.getURL('view', $queryParams)
   })
   #pagination($paginationParameters)
 
  table  id=searchResults class=grid sortable doOddEven
   tr class=sortHeader
 thMístnost/th
 thZodpovědná osoba/th
 th class=unsortableOperace/th
/tr
 
#foreach($row in $dbc.executeQuery(select id_room, mistnost, prijmeni,
  jmeno from room, osoby where room.id_os = osoby.id_os limit
  $paginationParameters.firstItem, $paginationParameters.itemsPerPage))
tr
 td $row.getString(mistnost) /td
 td $row.getString(prijmeni) $row.getString(jmeno)/td
 td
EditRoom?id_room=$row.getLong(
DeleteRoom?id_room=$row.getLong(
 /td
/tr
#end
/table
 
   #set($discard = $paginationParameters.put('position', 'bottom'))
   #pagination($paginationParameters)
  --
  View this message in context:
 http://xwiki.475771.n2.nabble.com/Pagination-macro-with-sortable-table-tp5787879p5787879.html
  Sent from the XWiki- Users mailing list archive at Nabble.com.
  ___
  users mailing list
  users@xwiki.org
  http://lists.xwiki.org/mailman/listinfo/users
 
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users