Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Accessing t:dataTable tag rowCountVar in JavaScript

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to access the rowCountVar tag for t:dataTable in javascript. Here is the code snippet:

<t:dataTable id="emailTable" rowCountVar="rowCountVar">
... ... ...

<script>
var rowCount = "<%=rowCountVar%>";
alert("Number of rows in the table = " + rowCount);
</script>
</t:dataTable>

The jsp page does not load because javascript cannot resolve rowCountVar.

Please help!!
Yasmin
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi yasmin,

I see that you are trying to access a server-side dynamic value as a javascript's input value. Practically I dont think this is possible because of the fact that you are trying to dynamically update (this happen on the fly through jsp engine) a static field value after the page is processed by the jsp engine.

I see that you can solve your problem in 2 ways:

1). You can declare a hidden variable on you jsp and through javascript get the value of this hidden field and update your javascript's value with the hidden field value. Please remember to update this hidden variable through you backing bean.

2). You can still use the above suggested mechanism by actually updating the javascript variable with the same scriptlet you have currently. You would again need to assign this scriptlet value to some hidden variable and inturn capture this hidden field's value before rendering and assign to the javascript variable.

Please hollar if you found a better solution. Gud luck!
 
m yasmin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Phil,
Thanks for replying to my post. I went with solution 1.

Yasmin
 
m yasmin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Phil,
Thanks for replying to my post. I went with solution 1.

Yasmin
 
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic