Yii Framework Forum: Capture Double Click On Yii's Cgridview Row - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Capture Double Click On Yii's Cgridview Row Rate Topic: -----

#1 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 01 July 2014 - 08:55 AM

Reposting question from Stack Overflow, which didn't get enough attention there for past two days.

I'm using this simple Javascript code (attached as string to CGridView.selectionChanged property:

'function(id){location.href = update?id="+$.fn.yiiGridView.getSelection(id);}'

to capture click on any grid view's row and redirect user to update action for that particular row's entry.

How can I change it to react on double click only? CGridView exposes only selectionChanged event, no click or dblclick.

If I should do this in pure jQuery / Javascript, then which selector to use, to make sure, that double click event will be bind correctly to all CGridView's rows and what kind of jQuery code to use, to obtain an ID necessary for building up the route.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#2 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 03 July 2014 - 08:31 AM

I have solved this problem myself. If you're interested -- take a look at my Stack Overflow answer.

My solution uses own jQuery code. It is not based on yiiGridView.getSelection, because this method returns unreliable results (details in my answer).
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users