Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

selecting dynamically generated rows of a table

 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a table whose rows and it's values are obtained from DB...

Now I should be able to select a row from table which I am unable to achieve...

This is how the code looks like...







The values are getting displayed in the UI and on any row click I should highlight that row ...

For that I have a ChangeColor function as...





What should be the way to achieve it? I think my TR is wrong...correct me..
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pradeep ,

first parmeter to ChangeColor method should be tr element object,
that can be done by passing this as first parameter.

Hope this will help.
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is all the rows would have same id ,if I give something like id="tRow"

all rows should have different id so I gave like that ...how else can I call that Changecolor function??
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

call "selectColor(this)" onclick of tr
try this
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can see in my code that TR's are dynamically generated...

 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



use onclick="ChangeColor(this,true)" instead of onclick="ChangeColor('<%= j+1%>',true)"
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks mate! It's done.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic