Re: Datatables warning when using t:if test....

2013-10-25 Thread Steve
Thanks for getting back to us - Glad it helped! I'm regularly asking
questions here myself so I'm just happy I was able to help someone
else :D.

Have a good weekend,


On 25 October 2013 05:08, lidijaldo . lidija@gmail.com wrote:
 Will keep that in mind, thanks!

 Regards,
 Lidija


 On Thu, Oct 24, 2013 at 5:46 PM, Lance Java lance.j...@googlemail.comwrote:

 Note that @Import can also be placed on render methods (eg setupRender)
 instead of annotating at the class level. If used on a render method, the
 import will only happen when the component is actually rendered. This might
 be cleaner in this case.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Datatables warning when using t:if test....

2013-10-24 Thread lidijaldo .
I tried importJavaScriptLibrary and it is really done dynamically.

I did what you proposed:

@Inject @Path(context:js/jquery-ui-1.8.19.custom.min.js)
protected Asset jqueryUi;
 @Inject @Path(context:js/TableTools.js)
protected Asset tableTools;
 @Inject @Path(context:js/dataTables.editor.min.js)
protected Asset dataTablesEditorMin;
 @Inject @Path(context:js/dataTables.editor.commons.js)
protected Asset dataTablesEditorCommons;


In Java code I'm then checking whether I have data for datatable or not. If
I have the data, I'm importing the libraries:

 // import datatables and tabletools JS libraries
javaScriptSupport.importJavaScriptLibrary(jqueryUi);
javaScriptSupport.importJavaScriptLibrary(tableTools);
javaScriptSupport.importJavaScriptLibrary(dataTablesEditorMin);
javaScriptSupport.importJavaScriptLibrary(dataTablesEditorCommons);

It works perfectly :), thank you :).

Regards,
Lidija


On Wed, Oct 23, 2013 at 1:55 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Wed, 23 Oct 2013 07:14:43 -0200, Steve steves...@gmail.com wrote:

  Hi Lidija,


 Hi, guys!


  I had a similar question myself about conditionally including
 libraries and I believe you can find the answer here:
 http://tapestry.apache.org/**javascript.htmlhttp://tapestry.apache.org/javascript.html

 If you scroll down (or ctrl +f) to The importJavaScriptLibrary
 method - I think this may help you. It looks like the approach you
 are using is also documented under Approach 1: @Import.


 @Import will always do the import. I you use 
 JavaScriptSupport.**importJavaScriptLibrary(),
 you can do it dynamically. In addition, your problem may be solved by
 adding a test in the JavaScript code to check whether the table is actually
 there before applying the jQuery data table on it.


  Hope this helps, i'm new to Tapestry myself so please take what I say
 with a pinch of salt, but the documentation seems to show how it can
 be done (I believe you would just need an if statement in your page
 class).


 That's correct. :)

 --
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br


 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@tapestry.**apache.orgusers-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




Re: Datatables warning when using t:if test....

2013-10-24 Thread Lance Java
Note that @Import can also be placed on render methods (eg setupRender)
instead of annotating at the class level. If used on a render method, the
import will only happen when the component is actually rendered. This might
be cleaner in this case.


Re: Datatables warning when using t:if test....

2013-10-24 Thread lidijaldo .
Will keep that in mind, thanks!

Regards,
Lidija


On Thu, Oct 24, 2013 at 5:46 PM, Lance Java lance.j...@googlemail.comwrote:

 Note that @Import can also be placed on render methods (eg setupRender)
 instead of annotating at the class level. If used on a render method, the
 import will only happen when the component is actually rendered. This might
 be cleaner in this case.



Re: Datatables warning when using t:if test....

2013-10-23 Thread lidijaldo .
I figured out the difference:

when the if condition is met, the datatable isn't displayed.

The HTML source has the following libraries included:
script src=/assets/0.0.1-SNAPSHOT/ctx/js/jquery-ui-1.8.19.custom.min.js
type=text/javascript/script
script src=/assets/0.0.1-SNAPSHOT/ctx/js/TableTools.js
type=text/javascript/script
script src=/assets/0.0.1-SNAPSHOT/ctx/js/dataTables.editor.min.js
type=text/javascript/script
script src=/assets/0.0.1-SNAPSHOT/ctx/js/dataTables.editor.commons.js
type=text/javascript/script

When the if condition is NOT met, the datatable is displayed and ALSO the
tapestry libraries for datatables are included:

script
src=/assets/0.0.1-SNAPSHOT/jquery/assets/components/datatables/jquery.dataTables.js
type=text/javascript/script
script
src=/assets/0.0.1-SNAPSHOT/jquery/assets/components/datatables/dataTables.js
type=text/javascript/script

These 2 libraries are not included when the if condition is met and that's
why the javascript error occurs.

Is there a way to conditionally import the below javascript libraries?

@Import(stylesheet = {
context:layout/datatables/css/jquery.dataTables.css,
context:layout/datatables/css/dataTables.editor.css,
context:layout/tabletools/css/TableTools.css
},
library = {
context:js/jquery-ui-1.8.19.custom.min.js,
context:js/TableTools.js,
context:js/dataTables.editor.min.js,
context:js/dataTables.editor.commons.js
})

I don't want these libraries to be included when I'm not displaying the
datatable.
The second option is to include Tapestry's jquery.dataTables.js and
dataTables.js even in case when I'm not displaying the datatable.

How can this be easily achieved?

Regards,
Lidija


On Wed, Oct 23, 2013 at 7:29 AM, lidijaldo . lidija@gmail.com wrote:

 Hi,

 I stumbled upon the next warning a couple of times already and I still
 don't understand why I'm getting it. In our tapestry application we're
 using jquery datatables and it works ok. But in some cases the application
 starts giving me a javascript alert: *Warning: TableTools 2 requires
 DataTables 1.9.0 or newer - www.datatables.net/download*.

 In the Javascript console I see the following errors:

 TypeError: f.fn.DataTable is undefined

 ...ools:{});TableTools._aInstances.push(a);return 
 a.dom.container},cFeature:T,sFe...

 TableTools.js (line 76)
 TypeError: j is undefined

 ...(){},open:function(){},close:function(){}};f.models.field={className:,name:nul...

 dataTamin.js (line 13)
 TypeError: $.fn.dataTable is undefined

 editor = new $.fn.dataTable.Editor(options);// editor



 This is my tml file:

 html t:type=layout
   title=Modules
   xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd;
   xmlns:h=tapestry-library:jquery
   xmlns:p=tapestry:parameter

 div class=container
 br style=clear: both; /

 t:form t:id=moduleForm id=moduleForm class=TTWForm
 ui-sortable t:type=form 
 Choose module:
 select t:type=select
 t:id=selectModule
 t:model=moduleSelectModel
 encoder=moduleSelectEncoder
 t:value=module
 /
 input type=submit value=Submit/
 /t:form

 div class=clear/div
 /div

 t:if test=isModuleSelected
 table t:type=jquery/datatable t:id=najdiEdiDataTable
 t:source=datasource
t:row=dataTableRow t:rowIndex=index
 t:model=sourcemodel
t:rowsPerPage=10 t:options=dataTableOptions
 t:mode=true /
 /t:if

 /html


 ... Notice the section t:if test=...
 I'm trying not to display the datatable if there is no option selected via
 the dropdown menu.
 If I remove the t:if, there is no warning and the datatable is always
 displayed. If there is no option selected in the dropdown menu, it is
 empty, which is fine.

 So why the javascript error? What does the t:if have to do with it?

 Thanks in advance,
 Lidija




Re: Datatables warning when using t:if test....

2013-10-23 Thread Steve
Hi Lidija,

I had a similar question myself about conditionally including
libraries and I believe you can find the answer here:
http://tapestry.apache.org/javascript.html

If you scroll down (or ctrl +f) to The importJavaScriptLibrary
method - I think this may help you. It looks like the approach you
are using is also documented under Approach 1: @Import.

Hope this helps, i'm new to Tapestry myself so please take what I say
with a pinch of salt, but the documentation seems to show how it can
be done (I believe you would just need an if statement in your page
class).

Thanks,
Steve

On 23 October 2013 07:24, lidijaldo . lidija@gmail.com wrote:
 I figured out the difference:

 when the if condition is met, the datatable isn't displayed.

 The HTML source has the following libraries included:
 script src=/assets/0.0.1-SNAPSHOT/ctx/js/jquery-ui-1.8.19.custom.min.js
 type=text/javascript/script
 script src=/assets/0.0.1-SNAPSHOT/ctx/js/TableTools.js
 type=text/javascript/script
 script src=/assets/0.0.1-SNAPSHOT/ctx/js/dataTables.editor.min.js
 type=text/javascript/script
 script src=/assets/0.0.1-SNAPSHOT/ctx/js/dataTables.editor.commons.js
 type=text/javascript/script

 When the if condition is NOT met, the datatable is displayed and ALSO the
 tapestry libraries for datatables are included:

 script
 src=/assets/0.0.1-SNAPSHOT/jquery/assets/components/datatables/jquery.dataTables.js
 type=text/javascript/script
 script
 src=/assets/0.0.1-SNAPSHOT/jquery/assets/components/datatables/dataTables.js
 type=text/javascript/script

 These 2 libraries are not included when the if condition is met and that's
 why the javascript error occurs.

 Is there a way to conditionally import the below javascript libraries?

 @Import(stylesheet = {
 context:layout/datatables/css/jquery.dataTables.css,
 context:layout/datatables/css/dataTables.editor.css,
 context:layout/tabletools/css/TableTools.css
 },
 library = {
 context:js/jquery-ui-1.8.19.custom.min.js,
 context:js/TableTools.js,
 context:js/dataTables.editor.min.js,
 context:js/dataTables.editor.commons.js
 })

 I don't want these libraries to be included when I'm not displaying the
 datatable.
 The second option is to include Tapestry's jquery.dataTables.js and
 dataTables.js even in case when I'm not displaying the datatable.

 How can this be easily achieved?

 Regards,
 Lidija


 On Wed, Oct 23, 2013 at 7:29 AM, lidijaldo . lidija@gmail.com wrote:

 Hi,

 I stumbled upon the next warning a couple of times already and I still
 don't understand why I'm getting it. In our tapestry application we're
 using jquery datatables and it works ok. But in some cases the application
 starts giving me a javascript alert: *Warning: TableTools 2 requires
 DataTables 1.9.0 or newer - www.datatables.net/download*.

 In the Javascript console I see the following errors:

 TypeError: f.fn.DataTable is undefined

 ...ools:{});TableTools._aInstances.push(a);return 
 a.dom.container},cFeature:T,sFe...

 TableTools.js (line 76)
 TypeError: j is undefined

 ...(){},open:function(){},close:function(){}};f.models.field={className:,name:nul...

 dataTamin.js (line 13)
 TypeError: $.fn.dataTable is undefined

 editor = new $.fn.dataTable.Editor(options);// editor



 This is my tml file:

 html t:type=layout
   title=Modules
   xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd;
   xmlns:h=tapestry-library:jquery
   xmlns:p=tapestry:parameter

 div class=container
 br style=clear: both; /

 t:form t:id=moduleForm id=moduleForm class=TTWForm
 ui-sortable t:type=form 
 Choose module:
 select t:type=select
 t:id=selectModule
 t:model=moduleSelectModel
 encoder=moduleSelectEncoder
 t:value=module
 /
 input type=submit value=Submit/
 /t:form

 div class=clear/div
 /div

 t:if test=isModuleSelected
 table t:type=jquery/datatable t:id=najdiEdiDataTable
 t:source=datasource
t:row=dataTableRow t:rowIndex=index
 t:model=sourcemodel
t:rowsPerPage=10 t:options=dataTableOptions
 t:mode=true /
 /t:if

 /html


 ... Notice the section t:if test=...
 I'm trying not to display the datatable if there is no option selected via
 the dropdown menu.
 If I remove the t:if, there is no warning and the datatable is always
 displayed. If there is no option selected in the dropdown menu, it is
 empty, which is fine.

 So why the javascript error? What does the t:if have to do with it?

 Thanks in advance,
 Lidija



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Datatables warning when using t:if test....

2013-10-23 Thread Thiago H de Paula Figueiredo

On Wed, 23 Oct 2013 07:14:43 -0200, Steve steves...@gmail.com wrote:


Hi Lidija,


Hi, guys!


I had a similar question myself about conditionally including
libraries and I believe you can find the answer here:
http://tapestry.apache.org/javascript.html

If you scroll down (or ctrl +f) to The importJavaScriptLibrary
method - I think this may help you. It looks like the approach you
are using is also documented under Approach 1: @Import.


@Import will always do the import. I you use  
JavaScriptSupport.importJavaScriptLibrary(), you can do it dynamically. In  
addition, your problem may be solved by adding a test in the JavaScript  
code to check whether the table is actually there before applying the  
jQuery data table on it.



Hope this helps, i'm new to Tapestry myself so please take what I say
with a pinch of salt, but the documentation seems to show how it can
be done (I believe you would just need an if statement in your page
class).


That's correct. :)

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Datatables warning when using t:if test....

2013-10-22 Thread lidijaldo .
Hi,

I stumbled upon the next warning a couple of times already and I still
don't understand why I'm getting it. In our tapestry application we're
using jquery datatables and it works ok. But in some cases the application
starts giving me a javascript alert: *Warning: TableTools 2 requires
DataTables 1.9.0 or newer - www.datatables.net/download*.

In the Javascript console I see the following errors:

TypeError: f.fn.DataTable is undefined

...ools:{});TableTools._aInstances.push(a);return
a.dom.container},cFeature:T,sFe...

TableTools.js (line 76)
TypeError: j is undefined

...(){},open:function(){},close:function(){}};f.models.field={className:,name:nul...

dataTamin.js (line 13)
TypeError: $.fn.dataTable is undefined

editor = new $.fn.dataTable.Editor(options);// editor



This is my tml file:

html t:type=layout
  title=Modules
  xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd;
  xmlns:h=tapestry-library:jquery
  xmlns:p=tapestry:parameter

div class=container
br style=clear: both; /

t:form t:id=moduleForm id=moduleForm class=TTWForm
ui-sortable t:type=form 
Choose module:
select t:type=select
t:id=selectModule
t:model=moduleSelectModel
encoder=moduleSelectEncoder
t:value=module
/
input type=submit value=Submit/
/t:form

div class=clear/div
/div

t:if test=isModuleSelected
table t:type=jquery/datatable t:id=najdiEdiDataTable
t:source=datasource
   t:row=dataTableRow t:rowIndex=index
t:model=sourcemodel
   t:rowsPerPage=10 t:options=dataTableOptions
t:mode=true /
/t:if

/html


... Notice the section t:if test=...
I'm trying not to display the datatable if there is no option selected via
the dropdown menu.
If I remove the t:if, there is no warning and the datatable is always
displayed. If there is no option selected in the dropdown menu, it is
empty, which is fine.

So why the javascript error? What does the t:if have to do with it?

Thanks in advance,
Lidija