Click Event is not triggering on selection of Row

Click Event is not triggering on selection of Row

whefnerwhefner Posts: 9Questions: 0Answers: 0
edited November 2011 in General
I am having difficulty getting the click event on the row to trigger correctly. I have attached the code that is in use below. It looks like it should work but when I click the row the click event doesn't fire.


Here is the HTML generated from my ajaxSource

[code]

/* Actual generated data from ajaxSource looks like the below content */



announcementsChurch is cancelled due to weather
2011-11-162011-11-16 19:38:23
2011-11-16 19:38:23
whefner



testtest2
0000-00-00
0000-00-00 00:00:00
0000-00-00 00:00:00
whefner


[/code]


Here is the PHP source I am using.


[code]
<?php

session_start();

require_once 'util/RoleBitMaskHelper.class.php';

if(!isset($_SESSION['username']) || !RoleBitMaskHelper::isAuthorized($_SESSION['rolebm'],RoleBitMaskHelper::ADMIN_ROLE)) {
header("location:accessdenied.php");
}

$username = $_SESSION['username'];

?>











var oTable;

$(document).ready(function() {


oTable = $('#messages').dataTable( {
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true,
"sPaginationType": "full_numbers",
"sAjaxSource": 'retrieveusers.php'
} );


/* Add a click handler to the rows - this could be used as a callback */
$('#messages tbody tr').live('click', function () {
if ( $(this).hasClass('row_selected') )
$(this).removeClass('row_selected');
else
$(this).addClass('row_selected');
});

/* Add a click handler for the delete row */
$('#delete').click( function() {
var anSelected = fnGetSelected( oTable );
oTable.fnDeleteRow( anSelected[0] );
} );




/* Add a click handler for the Add row */
$('#Add').click( function() {
var anSelected = fnGetSelected( oTable );

oTable.fnDeleteRow( anSelected[0] );
} );







} );


/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();

for ( var i=0 ; i 0 && foundselected==false) {
alert('Please select an item to work on');
return;
}

document.location.href=str;
}

function deleteRow(selection) {

var str = 'messageform.php';
var source = '';
var foundselected = false;

for (i=0; i 0) {
str = str + '?source=' + source;
}

if(selection.length > 0 && foundselected==false) {
alert('Please select an item to delete on');
return;
}

document.location.href=str;
}





@import "DataTable/css/esc_table.css";




<?php


/*
* IMPORTANT NOTE: This generated file contains only a subset of huge amount
* of options that can be used with phpMyEdit. To get information about all
* features offered by phpMyEdit, check official documentation. It is available
* online and also for download on phpMyEdit project management page:
*
* http://platon.sk/projects/main_page.php?project_id=5
*
* This file was generated by:
*
* phpMyEdit version: 5.7.1
* phpMyEdit.class.php core class: 1.204
* phpMyEditSetup.php script: 1.50
* generating setup script: 1.50
*/

// MySQL host name, user name, password, database, and table
require_once 'db_params.php';

?>

Update Messages
To edit a message click on the source link.
Select the check box next to a message and click delete to delete it.
Columns can be sorted in ascending or descending order by clicking on the column name.











<!-- Select     -->
Source
Message
Message Date
Date Added
Date Modified
User




<!-- Select -->
Source
Message
Message Date
Date Added
Date Modified
User












[/code]

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Looks to me like it should work. Have you tried using Visual Event on it to check that the events are being attached as needed: http://www.sprymedia.co.uk/article/Visual+Event+2 ? If that's okay, can you give us a link to your page please so we can see it in action.

    Allan
  • whefnerwhefner Posts: 9Questions: 0Answers: 0
    I checked the VisualEvent and it does appear the event is attached, but I never see it fire when I use firebug to debug clicking on the row.

    Unfortunately, I only have this on my local laptop right now. Trying to get it ready where I can deploy elsewhere but not at that point yet.
  • whefnerwhefner Posts: 9Questions: 0Answers: 0
    I think I found the issue. Had a typo in my CSS. Thx for the help.
This discussion has been closed.