mikesta707 Posted October 13, 2009 Share Posted October 13, 2009 Ok, so i defined a class, like so function quality(array, tblID, tblHeader){ //the name of the object variable that the class is referenced to. //needed for explicit calls to class functions. this.name1; //Declare the classes variables this.data = array; this.header = tblHeader; //the columns that are numeric. supplied by PHP this.numericCols; //HTML elements linked Via ID this.table = tblID; this.filter; this.results; //Row Deletion Text Boxes this.delRowID; this.delRangeID; //goto row this.goToRow; this.poop = "pop";//this does nothing this.rowStyle="#00FF00"; this.rowCount; this.query; this.customFuncs = new Array(); //ajax stuff this.ajaxGet = ajaxGet; this.ajaxGetId; //sort stuff this.lastsort = 0; this.lastsort2 = null; this.reverse = false; //undo/redo vars this.oldData = new Array(); this.redoData = new Array(); this.ds = 1; //percentage variables this.isPercent = false; this.percentThreshold; this.styleAbove; this.styleBelow; this.PercentCol = null; this.customPercent; //used to undo highlights this.lastHighlighted; //declare the functions this.setName = setName; this.fill_table = fill_table; this.getResults = getResults; this.removeResults = removeResults; this.whatDo = whatDo; this.setFilter = setFilter this.searchArray = searchArray; this.searchArrays = searchArrays; this.regexBuilder = regexBuilder; this.removeZero = removeZero; this.compareToColumn = compareToColumn; this.equalToColumn = equalToColumn; this.returnData = returnData; this.gogo = gogo; this.removeHighlights = removeHighlights; this.deleteRange = deleteRange; this.isBetween = isBetween; this.deleteRow = deleteRow; this.fetchData = fetchData; this.setResults = setResults; this.duplicates = duplicates; //this.modifier = 1;//this is for numeric sorts. for a specific page, if you want to change the way things sort (IE make them go opposite of what they should //change this to -1; //no longer used //the most ridiculous function in the world //takes custom function and assigns it to an entry point specified this.setCustomCriteria = setCustomCriteria; //more undo/redo stuff this.redo = redo; this.undo = undo; this.put = put; this.redoput = redoput; //styles! this.setRowHighlightStyle = setRowHighlightStyle; } the important part of it is the this.ajaxGet=ajaxGet; I define this function as follows function ajaxGet(page){ xml = GetXmlHttpObject(); if (xml == null){ alert("This browser does not support AJAX. You will lose some functionality"); return; } url = page; url += "?q="+this.query+"&t="+document.getElementById(this.ajaxGetId).value; //alert(url); xml.onreadystatechange = function() { if (xml.readyState==4){ //alert(xml.responseText); this.data = xml.responseText; //alert(this.data); this.fill_table(); } } xml.open("GET", url, true); xml.send(null); } the problem is i get an error that sais this.fill_table() isn't a function. I use the same exact call in many other places in the class, and everything is fine. for example, here function undo() { this.redoput(this.data); this.data = this.oldData[this.oldData.length-1]; this.oldData.splice(this.oldData.length-1,1); if (this.oldData.length < 1){ document.getElementById("undo").disabled=true; } this.fill_table(); } but in the ajaxGet() function, it doesn't work. That function is able to access the other class data members perfectly fine though. I just don't understand whats happening. Anyone have a clue? Quote Link to comment https://forums.phpfreaks.com/topic/177586-solved-strange-class-behavior/ Share on other sites More sharing options...
mikesta707 Posted October 13, 2009 Author Share Posted October 13, 2009 nevermind I figured out why this was happeneing. I have a new error now Quote Link to comment https://forums.phpfreaks.com/topic/177586-solved-strange-class-behavior/#findComment-936373 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.