PHP Classes

OnClick

Recommend this page to a friend!

      DrasticTools  >  All threads  >  OnClick  >  (Un) Subscribe thread alerts  
Subject:OnClick
Summary:OnClick
Messages:3
Author:Chus Periago
Date:2010-10-15 15:08:11
Update:2013-05-03 14:02:44
 

  1. OnClick   Reply   Report abuse  
Picture of Chus Periago Chus Periago - 2010-10-15 15:08:11
Hello!

First of all, congratulations for this fantastic tool!

I'm trying to get another column value, when OnClick is activated... As i read, I have the following in php file:

var thegrid = new drasticGrid('grid1', {
pathimg:"img/",
pagelength: 30,
columns: [
{name: 'idCliente', displayname: 'idCliente', editable: false, width: 100},
{name: 'nombre', displayname: 'Nombre', editable: false, width: 200},
{name: 'direccion', displayname: 'Dirección', editable: false, width: 250},
{name: 'cp', displayname: 'CP', editable: false, width: 60} ,
{name: 'poblacion', displayname: 'Población', editable: false , width: 200}
],
sliderposition: "right",
onClick: function(id,someothercol){thegrid.DefaultOnClick(id); alert('clicked on row with id and col value = '+id+','+someothercol)}


});

And I modified the JS:

fireEvent("onClick", t.data[0][this.ddid], t.data[1][this.ddid][2]);

But it doesn't works, always appears 1,undefined

What is the problem?

Thanks


  2. Re: OnClick   Reply   Report abuse  
Picture of dd dd - 2010-10-18 12:40:16 - In reply to message 1 from Chus Periago
Hi Chus Periago,

If more than one argument is to be passed through fireEvent, one must collect the args in an array as the second argument.
See the mootools documentation:
mootools.net/docs/core/Element/Elem ...:fireEvent

Besides: the third argument in the fireEvent code in drasticgrid does not do anything. It could better be left out.

Hope this helps.

regards,

dd

  3. Re: OnClick   Reply   Report abuse  
Picture of Peter Whisker Peter Whisker - 2013-05-03 14:02:44 - In reply to message 2 from dd
Hi

I have looked at the mootools documentation and replaced the line in drasticGrid.js by:

t.fireEvent("onClick", [ t.data[0][this.ddid], t.data[1][this.ddid][1] ]);

In the new drasticGrid instantiation, I have the line:

onClick: function(id) {

I had assumed that "id" would now be passed the array (of two parameters), however it still seems to be a scalar of just the first parameter of the array in the fireEvent.

Do you know what I am doing wrong?

Thanks
Peter