[ create a new paste ] login | about

Link: http://codepad.org/AzYKRo8o    [ raw code | fork ]

C, pasted on Oct 30:
                     <div id="hiddenRedirect">
                     	<form name="myredirect" id="myredirect" action="xmldoc.php" method="post">
                        	<input type="hidden" name="curXMLDocID" id="curXMLDocID"/>
	                        <input type="hidden" name="myaction" id="myaction"/>
                        </form> 
	                </div>


	//onCellClick to Delete Record with Ajax Function
		var target, column, record;
		var onCellClick = function(oArgs) {
			target = oArgs.target;				// cell element
			var targetDiv = YAHOO.util.Dom.getFirstChild(target);
			column = this.getColumn(target);	// column reference
			record = this.getRecord(target);	// record object
			var curXMLDocID = record.getData("XMLDocID");

			switch (column.action) {
				case 'edit':  // edit XMLDoc
					if (YAHOO.util.Dom.hasClass(targetDiv,'edit-button')) {		// if row has edit rights
						YAHOO.util.Dom.get("curXMLDocID").value = curXMLDocID;
						YAHOO.util.Dom.get("myaction").value = "edit";
						YAHOO.util.Dom.get("myredirect").submit();
					}
					break;
				case 'view':  // view XMLDoc
						YAHOO.util.Dom.get("curXMLDocID").value = curXMLDocID;
						YAHOO.util.Dom.get("myaction").value = "view";
						YAHOO.util.Dom.get("myredirect").submit();
					break;				
				default:
					break;
			}
		};
			
		sDataTable.subscribe('cellClickEvent', onCellClick );					// call onCellClick when a cell is clicked


Create a new paste based on this one


Comments: