|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Using YAHOO.util.Dom.hasClass on datatable cellI'm stuck trying to check if a datatable cell has a class.
I added the class to the cell with Y..addClass but I can't seem to return if the cell has the class. i see in firebug that the class "edit-button" is being assigned to the div in the td. My console.log on the last line doesn't not return true like I expect though. Thanks for the help. // edit Record ToolTip var edit = function(el, oRecord) { // console.log("XMLDocID: " + oRecord.getData('XMLDocID') + ", AuthorID: " + oRecord.getData('AuthorID') + ", EditorID: " + oRecord.getData('EditorID') + ", ReviewerID: " + oRecord.getData('ReviewerID') + ", PublisherID: " + oRecord.getData('PublisherID')); if(oRecord.getData('AuthorID') ==YAHOO.techdocs.myuserid || oRecord.getData('Editor') ==YAHOO.techdocs.myuserid) { YAHOO.util.Dom.addClass(el, 'edit-button'); } }; ------------- //onCellClick to Delete Record with Ajax Function var target, column, record; var onCellClick = function(oArgs) { target = oArgs.target; // cell element column = this.getColumn(target); // column reference record = this.getRecord(target); // record object var curXMLDocID = record.getData("XMLDocID"); console.log("cell class is: " + YAHOO.util.Dom.hasClass(target,'edit-button')); ..... |
|
|
Re: Using YAHOO.util.Dom.hasClass on datatable cellDue to the hierarchy of classNames that encompasses a datatable, it is
often the case that the priorities of one style supersedes yours. See: http://www.satyam.com.ar/yui/widgetstyles.html The elCell element given by the cell formatter is the liner element, the target of the event is the td element. That might account for your code not seeing it. Satyam juliebonniedaisy escribió: > I'm stuck trying to check if a datatable cell has a class. > > I added the class to the cell with Y..addClass but I can't seem to return if the cell has the class. i see in firebug that the class "edit-button" is being assigned to the div in the td. My console.log on the last line doesn't not return true like I expect though. Thanks for the help. > > // edit Record ToolTip > var edit = function(el, oRecord) { > // console.log("XMLDocID: " + oRecord.getData('XMLDocID') + ", AuthorID: " + oRecord.getData('AuthorID') + ", EditorID: " + oRecord.getData('EditorID') + ", ReviewerID: " + oRecord.getData('ReviewerID') + ", PublisherID: " + oRecord.getData('PublisherID')); > if(oRecord.getData('AuthorID') ==YAHOO.techdocs.myuserid || oRecord.getData('Editor') ==YAHOO.techdocs.myuserid) { > YAHOO.util.Dom.addClass(el, 'edit-button'); > } > }; > > > ------------- > //onCellClick to Delete Record with Ajax Function > var target, column, record; > var onCellClick = function(oArgs) { > target = oArgs.target; // cell element > column = this.getColumn(target); // column reference > record = this.getRecord(target); // record object > var curXMLDocID = record.getData("XMLDocID"); > console.log("cell class is: " + YAHOO.util.Dom.hasClass(target,'edit-button')); > ..... > > > > > > ------------------------------------ > > Yahoo! Groups Links > > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.423 / Virus Database: 270.14.34/2462 - Release Date: 10/27/09 07:38:00 > > |
| Free embeddable forum powered by Nabble | Forum Help |