PHP Classes

Onclick Event

Recommend this page to a friend!

      DrasticTools  >  All threads  >  Onclick Event  >  (Un) Subscribe thread alerts  
Subject:Onclick Event
Summary:Gird col. value in onclick handler
Messages:5
Author:rajesh modi
Date:2010-06-10 04:02:39
Update:2010-06-12 21:23:47
 

  1. Onclick Event   Reply   Report abuse  
Picture of rajesh modi rajesh modi - 2010-06-10 04:02:39
I am impressed with Drastictools, Thanks for your continuous effoerts. I am new to Javascript and Ajax. My problem is, how to access other col. values of clicked row in Grid's onclick event handler.Should I need to fire another Ajax request with row id as parameter or I may get value from already set javacript data/col variable

  2. Re: Onclick Event   Reply   Report abuse  
Picture of dd dd - 2010-06-10 21:14:32 - In reply to message 1 from rajesh modi
Hi rajesh,

Thanks for the compliment.
To retrieve another field you could indeed do another Ajac call, but it is not necessary as the data is already loaded in the javescript data array.

The most easy way to retrieve another column is to extend the fireEvent function (line 236 of drasticgrid.js) with another parameter, which includes the value of the column you want.
Foe example:
t.fireEvent("onClick", t.data[0][this.ddid], t.data[1][this.ddid][2]);

Then, you can read the value in the onclick function.
Hope this helps...

regards,
DD team

  3. Re: Onclick Event   Reply   Report abuse  
Picture of rajesh modi rajesh modi - 2010-06-11 04:45:19 - In reply to message 2 from dd
Hi,
Thanks for your prompt reply.Really a pleasant surprise for me to get such quick response from your Development team.

I will implement your suggestions and post my response asap.

All the best wishes for success of Drastic Tools

regards

  4. Re: Onclick Event   Reply   Report abuse  
Picture of rajesh modi rajesh modi - 2010-06-11 16:18:29 - In reply to message 2 from dd
Hi,
Thanks for reply, As I understand I need to change following; If I am wrong kindly correct me.

1. Line 236 in drasticgrid.js as suggested by you;.fireEvent("onClick", t.data[0][this.ddid], t.data[1][this.ddid][2]); -- Just the example

2. Do I need to change function header function(id) to add new parameter as function(id,someothercol) in drasticgrid.js, whereever it occurs.

3. In event handler I understand I may access value like this;

onClick: function(id,someothercol){thegrid.DefaultOnClick(id); alert('clicked on row with id and col value = '+id+','+someothercol)}

sorry in advance if I have put sonething stupid

regards

Rajesh Modi

  5. Re: Onclick Event   Reply   Report abuse  
Picture of dd dd - 2010-06-12 21:23:47 - In reply to message 4 from rajesh modi
Hi,

Yes, that is the idea. Of course, we did not test it out, but from viewing the code, that seems the way to go.
One remark:
in fireEvent("onClick", t.data[0][this.ddid], t.data[1][this.ddid][2])
the [2] indicates the column nr. fro which you want to retrieve the value.
Change it into the right one for you.

regards,

DD