1 require(DATAFACE_URL+'/js/ajax.js'); 2 require(DATAFACE_URL+'/js/Dataface/Record.js'); 3 function Dataface_ResultList(){} 4 5 Dataface_ResultList.prototype.showRecordDetails = function(img,id){ 6 var cell = document.getElementById(id+'-cell'); 7 var row = document.getElementById(id+'-row'); 8 row.style.display = ''; 9 img.src = DATAFACE_URL+'/images/treeExpanded.gif'; 10 img.onclick = function(){ resultList.hideRecordDetails(img,id); }; 11 12 if ( !cell.detailsLoaded ){ 13 cell.detailsLoaded = true; 14 this.http = getHTTPObject(); 15 var record = new Dataface_Record(getRecord(id)); 16 var url = record.getURL('-action=ajax_view_record_details'); 17 this.http.open('GET', url); 18 this.img = img; 19 this.row = row; 20 this.cell = cell; 21 this.id = id; 22 this.http.onreadystatechange = this.handleShowRecordDetails; 23 this.http.send(null); 24 } 25 26 } 27 28 Dataface_ResultList.prototype.handleShowRecordDetails = function(){ 29 30 if (resultList.http.readyState == 4 ){ 31 resultList.cell.innerHTML = resultList.http.responseText; 32 if ( typeof(df_add_editable_awareness)=='function' ){ 33 df_add_editable_awareness(resultList.cell); 34 } 35 36 37 } 38 } 39 40 Dataface_ResultList.prototype.hideRecordDetails = function(img,id){ 41 var row = document.getElementById(id+'-row'); 42 row.style.display = 'none'; 43 img.src = DATAFACE_URL+'/images/treeCollapsed.gif'; 44 img.onclick = function(){ resultList.showRecordDetails(img,id); }; 45 46 } 47 var resultList = new Dataface_ResultList();