Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display:column + javascript

 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I Want to pass the "id" attribute to my javascript function.

My jsp:



please help me out.

Thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
URGENT!!! Read this ASAP!

Showing us Serverside markup does not help. Look at the generated html source and paste that here.

I am off to bed, so I can not answer your URGENT query.

Eric

 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:URGENT!!! Read this ASAP!

Showing us Serverside markup does not help. Look at the generated html source and paste that here.

I am off to bed, so I can not answer your URGENT query.

Eric


 
Romit Bose
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
wouldn't it be nice to pass 'this' from the element to your javascript? instead of passing rowId?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I woke up thinking I would see some nice generated code and to my surprise I did not. If you show us some code that is not the serverside markup we will be able to see your problem.

Eric
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:So I woke up thinking I would see some nice generated code and to my surprise I did not. If you show us some code that is not the serverside markup we will be able to see your problem.

Eric



 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The forum removed the event handlers since the html markup was not in a code tag.

Please check the "Disable HTML in this message" checkbox and repost your code.

Eric
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:The forum removed the event handlers since the html markup was not in a code tag.

Please check the "Disable HTML in this message" checkbox and repost your code.

Eric




 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what is $(Emptbl.id)

Eric
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:And what is $(Emptbl.id)

Eric


Emptbl is the table id
id is the property whose value i want to pass to the javascript function.


 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if Emptbl an html table or an JSON object?

Eric
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:if Emptbl an html table or an JSON object?

Eric


html table
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't your code be


or just



Eric
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:Shouldn't your code be


or just



Eric




this is the error i get :

According to TLD or attribute directive in tag file, attribute value does not accept any expressions

I tried both the solutions.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Than that is serverside code, what does

1. "javascript:EmpSelected($('Emptbl').id)"

render when you look at it view the view source of the browser?

Eric
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:Than that is serverside code, what does

1. "javascript:EmpSelected($('Emptbl').id)"

render when you look at it view the view source of the browser?

Eric


the page is displayed with Error. I cant view its source. What do i do?

Thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, go back to the way it was before?

I think you were using some sort of JavaScript library there and not serverside code.

I know what the problem is, I am trying to get you to see it be looking at the source code that is generated by your server.

Eric
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:Um, go back to the way it was before?

I think you were using some sort of JavaScript library there and not serverside code.

I know what the problem is, I am trying to get you to see it be looking at the source code that is generated by your server.

Eric

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
code looks the same

Why is $(Emptbl.id) not being converted to some sort of string?

Eric
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:code looks the same

Why is $(Emptbl.id) not being converted to some sort of string?

Eric


Even I am trying to figure out the same.
I also tried this:
<display:column class="idColumn" property="id" title="Id" sortable="true" href="javascript:EmpSelected('<cut value="*$(EmpTbl.id)*">')" style="width: 70px">
</display:column>

But i am getting syntax error.
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deeps Mistry wrote:
Eric Pascarello wrote:code looks the same

Why is $(Emptbl.id) not being converted to some sort of string?

Eric


Even I am trying to figure out the same.
I also tried this:
<display:column class="idColumn" property="id" title="Id" sortable="true" href="javascript:EmpSelected('<cut value="*$(EmpTbl.id)*">')" style="width: 70px">
</display:column>

But i am getting syntax error.


Any idea ranchers? what am i doing wrong?
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is $(EmpTbl.id) correct? Should it be ${EmpTbl.id}? (I ve not followed the complete thread)

Also the javascript call can be with escaped quotes:

or


Regards
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Himanshu Kansal wrote:Is $(EmpTbl.id) correct? Should it be ${EmpTbl.id}? (I ve not followed the complete thread)

Also the javascript call can be with escaped quotes:

or


Regards


Hey, thanks a lot for your quick rsponse.

I tried


and the corresponding server side code is:



two problems over here:
1) same value for each row i.e in my case "pm am"
2) when i click on the link, the javascript function doesnt get called. I dont get the alert.

Thanks
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, good we are reaching somewhere.

I see your link as <a href="javascript:EmpSelected("pm am")">ok fine</a>
should be: or . So tweak it.

Does using $(Emptbl.id) for ${Emptbl.id} iterates over the values?

Regards
 
Punit Singh
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Did you try this one:


 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Punit Singh wrote:Hi,

Did you try this one:



this should do
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic