Hi Folks,
Is there any unique identifier associated with a re-written link field in a view?
Context for the above question: AJAX is dead simple for links. There are four steps:
1. call hook_menu to establish two paths and the attendant callbacks <path-ante>/nojs/<path-post> and <path-ante>/ajax/<path-post> 2. re-write the path to include "/nojs" somewhere 3. tag the relevant links with "class=use-ajax" 4. include the line "drupal_add_library('system', 'drupal.ajax');" in the page.
Here's the problem. When I receive the AJAX post in the callback for the path <path-ante>/ajax/<path-post>, I have to respond with the new HTML and a jQuery selector to indicate the "target" of my AJAX updates to the DOM. Since I don't know the DOM node that is calling me, I don't know how to tell the browser to select it. If there were some unique identifier, then when I re-write the link I can add this to the custom css classes that also are included with the re-write.
Chris.
Chris, If I understand it correctly, this solution might work for you. Every element when Views render, it adds a unique class to it, something like - "views-row-1" OR "col-1" You can pass in the "event" in the function called, and get the details about the div, which contained that link, via ".parent" Hope this helps...
On Fri, Nov 1, 2013 at 1:14 AM, Chris Miller cjm@tryx.org wrote:
Hi Folks,
Is there any unique identifier associated with a re-written link field in a view?
Context for the above question: AJAX is dead simple for links. There are four steps:
- call hook_menu to establish two paths and the attendant callbacks
<path-ante>/nojs/<path-post> and <path-ante>/ajax/<path-post> 2. re-write the path to include "/nojs" somewhere 3. tag the relevant links with "class=use-ajax" 4. include the line "drupal_add_library('system', 'drupal.ajax');" in the page.
Here's the problem. When I receive the AJAX post in the callback for the path <path-ante>/ajax/<path-post>, I have to respond with the new HTML and a jQuery selector to indicate the "target" of my AJAX updates to the DOM. Since I don't know the DOM node that is calling me, I don't know how to tell the browser to select it. If there were some unique identifier, then when I re-write the link I can add this to the custom css classes that also are included with the re-write.
Chris.
-- [ Drupal support list | http://lists.drupal.org/ ]