Hi,
This was not happening with the 4/5 nightly. But, when I try to use the included jsp code with the 6/8 nightly in the examples/databinding directory, I get the folllowing error message:
Table not found in statement [SELECT animals.picture, animals.commonName, animals.information, animals.lifeSpan, animals.scientificName, animals.diet, animals.status FROM animals]
It looks like the datasource definition has not changed in between the nightlies so not sure what is going on?
This was not happening with the 4/5 nightly. But, when I try to use the included jsp code with the 6/8 nightly in the examples/databinding directory, I get the folllowing error message:
Table not found in statement [SELECT animals.picture, animals.commonName, animals.information, animals.lifeSpan, animals.scientificName, animals.diet, animals.status FROM animals]
It looks like the datasource definition has not changed in between the nightlies so not sure what is going on?
Code:
<%@ taglib uri="/WEB-INF/iscTaglib.xml" prefix="isomorphic" %> <HEAD><TITLE> SmartClient SDK - Animal Data Binding example </TITLE> <style> input.file { position: relative; text-align: right; -moz-opacity:0 ; filter:alpha(opacity: 0); opacity: 0; z-index: 2; color:#CCCCCC; } .uploadControl{ width:500px; color:#CCCCCC; } </style> </HEAD><isomorphic:loadISC skin="SmartClient"/> <BODY BGCOLOR=#D3D3D3> <SCRIPT> <isomorphic:XML> <jsp:include page="../shared/ds/animals.ds.xml"></jsp:include> </isomorphic:XML> var faDS = isc.DataSource.getDataSource("animals"); faDS.addMethods({ fetchData : function (record, callback, requestProperties) { if (requestProperties == null) requestProperties = {}; //do not use this short fetch below here for FundAsset //if (requestProperties.timeout == null) requestProperties.timeout = 1000; if (requestProperties.prompt == null) requestProperties.prompt = "fetching1_test"; return this.Super("fetchData", [record, callback, requestProperties]); }, updateData : function (record, callback, requestProperties) { if (requestProperties == null) requestProperties = {}; if (requestProperties.prompt == null) requestProperties.prompt = "saving_test"; if (requestProperties.timeout == null) requestProperties.timeout = 2000 return this.Super("updateData", [record, callback, requestProperties]); }, addData : function (record, callback, requestProperties) { if (requestProperties == null) requestProperties = {}; if (requestProperties.prompt == null) requestProperties.prompt = "adding_test"; if (requestProperties.timeout == null) requestProperties.timeout = 2500; return this.Super("addData", [record, callback, requestProperties]); }, transformRequest : function (dsRequest) { dsRequest.data = stripDSFields(dsRequest.data, faDS.fields,true,true,false); dsRequest.oldValues = stripDSFields(dsRequest.oldValues, faDS.fields,true,true,false); var params = { cvsTag : "cvsTag_1", browser:"Firefox", browserVersion:"3.6", browserOS:"Windows", requestUserID: 1, departmentID: 2, companyID:3 }; if(isc.getValueForKey("test1ID",dsRequest.data)=="test1ID" ){ params.test1ID=14; } if(isc.getValueForKey("test2ID",dsRequest.data)=="test2ID" ){ params.test2ID=28; } if(isc.getValueForKey("test3ID",dsRequest.data)=="test3ID" ){ if(at.initialLayoutComplete){ params.test3ID=28; }else{ params.test3ID=null; } } return isc.addProperties({}, dsRequest.data, params); } }) var at={}; isc.setAutoDraw(false); isc.Window.addProperties({ showHeaderBackground:false, //canDragResize:true, //showFooter:true, //showResizer:true, autoDraw: false, autoCenter: true, autoSize: true, dismissOnEscape: true, showCloseButton: true, showMinimizeButton: true }) var demoApp={}; isc.HTMLFlow.create({ ID:"animalMessage", padding:10, width:650, contents:"Animal Details" }); isc.HTMLFlow.create({ ID:"animalMessage2", padding:10, contents:"Animal Details" }); isc.HTMLFlow.create({ ID:"animalMessage3", padding:10, contents:"Animal Details" }); isc.HTMLFlow.create({ ID:"animalMessage4", padding:10, contents:"Animal Details" }); isc.HTMLFlow.create({ ID:"animalMessage5", padding:10, contents:"Animal Details" }); isc.HTMLFlow.create({ ID:"animalMessage6", padding:10, contents:"Animal Details" }); isc.HTMLFlow.create({ ID:"animalMessage7", padding:10, contents:"Animal Details<br/><a style='display:inline' href='#' onclick='showAssetNotesWindow(null,true,null);' title='add notes'>add notes</a>" }); isc.DynamicForm.create({ID:"assetNotesEditor", overflow: "auto", fields:[{name:"assetID", type:"select",width:150,allowEmptyValue:false,colSpan:3, title:"asset",prompt:"prompt"},{name:"subject", cellStyle:"uploadControl",colSpan:3,width:150, prompt:"subject"},{name:"source", colSpan:3,width:150, prompt:"source"},{name:"attachedFile",title:"attachment",type:"binary",cellStyle:"uploadControl", prompt:"attachment test"},{name:"notes", showTitle:true, colSpan:3,height:375,width:"*", prompt:"notes"}],itemHoverAlign:"left",itemHoverHeight:100,itemHoverWidth:200,height:465,numCols:4,width:700,colWidths:[100,80,80,"*"]}); isc.DynamicForm.create({ID: "assetNotesWindowSave",numCols:4,width:"650",height:"25",itemHoverAlign:"left",itemHoverHeight:100,itemHoverWidth:200,colWidths:[100,120,80,"*"]}); function showAssetNotesWindow(record,add,assetID){ if(at.assetNotesWindow==null || !at.assetNotesWindow.isVisible() || !at.assetNotesWindow.isDrawn()){ if(at.assetNotesWindow==null){ var windowTitle = "notes"; at.assetNotesWindow = isc.Window.create({ title: windowTitle, items: [ assetNotesEditor,assetNotesWindowSave ] }); } } assetNotesEditor.markForRedraw(); at.assetNotesWindow.show(); at.assetNotesWindow.bringToFront(); } isc.HTMLFlow.create({ ID:"animalMessage8", padding:10, contents:"Animal Details" }); isc.HTMLFlow.create({ ID:"animalMessage9", padding:10, contents:"Animal Details" }); isc.DynamicForm.create({ ID: "animalGamesSummary", itemHoverAlign:"left", itemHoverHeight:100, itemHoverWidth:200, editEvent:"click", overflow: "auto", emptyMessage:"empty" }); function updateAnimalGamesSummary() { animalGamesSummaryFields = [ {type:"rowSpacer", height:10}, {name:"animalSummary"} ]; animalGamesSummary.setFields(animalGamesSummaryFields); } isc.DynamicForm.create({ title:"Games Editor", ID:"animalGamesEditor", overflow: "auto", itemHoverAlign:"left", itemHoverHeight:100, itemHoverWidth:200, emptyMessage:"empty" }); function updateAnimalGamesEditor() { animalGamesEditorFields = [ {type:"rowSpacer", height:10}, {name:"animalGamesEditor"} ]; animalGamesEditor.setFields(animalGamesEditorFields); } isc.DynamicForm.create({ title:"Data", ID:"animalDataEditor", overflow: "auto", itemHoverAlign:"left", itemHoverHeight:100, itemHoverWidth:200, emptyMessage:"empty" }); function updateAnimalDataEditor() { animalDataEditorFields = [ {type:"rowSpacer", height:10}, {name:"attachedFile",type:"binary"}, {name:"animalDataEditor"} ]; animalDataEditor.setFields(animalDataEditorFields); } isc.HLayout.create({ ID:"animalGamesSummaryLayout", members:[ animalGamesSummary, animalGamesEditor, animalDataEditor ] }); isc.DynamicForm.create({ ID: "animalGamesSave", autoDraw:false, numCols:5, width:"100%", itemHoverAlign:"left", itemHoverHeight:100, itemHoverWidth:200, colWidths:[80,80,80,80,"*"] }); function updateAnimalGamesSave(){ animalGamesSaveFields=[ {type:"button", cellPadding:0, startRow:false,endRow: false,prompt:"edit",title:"Edit", showTitle:false, showLabel:false}, {type:"button", cellPadding:0, startRow:false,endRow: false,prompt:"edit",title:"Add", showTitle:false, showLabel:false, click:"animalGamesGrid.startEditingNew();"} ]; animalGamesSave.setFields(animalGamesSaveFields); } isc.ListGrid.create({ ID:"animalGamesGrid", headerHeight:36, height:125, canHover:true, hoverWidth:150, hoverHeight:50, hoverAlign:"left", hoverVAlign:"center", canSort:false, stopOnErrors:true, headerButtonProperties:{ hoverWidth:200, hoverHeight:100, hoverAlign:"left", hoverVAlign:"center" }, listEndEditAction:"next", autoSaveEdits:false, editEvent:"click", emptyMessage:"empty", alternateRecordStyles: true, fields:[ {name:"lifeSpan", width:50,canEdit:true,formatCellValue:"if(grid == animalGamesGrid) return formatNumber(value,0,'years','after',false)" }, {name:"gameName", canEdit:true, prompt:"Game"} ] }) isc.SectionStack.create({ ID:"animalGamesSections", className:"borderBR", visibilityMode:"multiple", backgroundColor:"white", sections:[ { expanded:true, items:[animalGamesGrid],showHeader:false}, { expanded:true, items:[animalGamesSave],showHeader:false}, { expanded:true, items:[animalGamesSummaryLayout],showHeader:false} ] }); isc.SearchForm.create({ cellPadding:4, numCols:8, itemHoverAlign:"left", itemHoverHeight:100, itemHoverWidth:200, ID:"findAnimalsForm" }) function showQuickAddGrid(){ updateQuickAddGrid(); if(demoApp.quickAddWindow==null || !demoApp.quickAddWindow.isVisible() || !demoApp.quickAddWindow.isDrawn()){ demoApp.quickAddWindow = isc.Window.create({ title: "quick add", items: [ quickAddGrid ] }); quickAddGrid.setData([]); demoApp.quickAddWindow.show(); demoApp.quickAddWindow.bringToFront(); quickAddGrid.cancelEditing(); quickAddGrid.discardAllEdits(); quickAddGrid.markForRedraw(); quickAddGrid.delayCall("focus"); quickAddGrid.delayCall("startEditingNew"); } } //handles getting the grid's data whether the grid is grouped or ungrouped function getGridDataSet(grid,invalidateCache, useOriginalData, checkIfAllDataLoaded){ if(grid==null){ return null; } var dataSet=grid.data; if( ( useOriginalData==null ||useOriginalData) && grid.isGrouped && grid.originalData!=null){ dataSet=grid.originalData; } var dataLoaded = false; var allDataLoaded=false; var dataSetLength; if(grid.isGrouped){ if(grid.originalData!=null){ dataLoaded = isA.Function(grid.originalData.lengthIsKnown) && grid.originalData.lengthIsKnown(); if(dataLoaded){ //isc.Log.logInfo("in getGridDataSet, checking dataSetLength and rangeIsLoaded on grid.originalData"); dataSetLength = grid.originalData.getLength(); allDataLoaded = isA.Function(grid.originalData.rangeIsLoaded) && grid.originalData.rangeIsLoaded(0, dataSetLength); } } }else{ if(grid.data!=null){ dataLoaded = isA.Function(grid.data.lengthIsKnown) && grid.data.lengthIsKnown(); if(dataLoaded){ //isc.Log.logInfo("in getGridDataSet, checking dataSetLength and rangeIsLoaded on grid.data"); dataSetLength = grid.data.getLength(); allDataLoaded = isA.Function(grid.data.rangeIsLoaded) && grid.data.rangeIsLoaded(0, dataSetLength); } } } if(invalidateCache && dataSet!=null && dataSet!=''){ if(allDataLoaded){ //data is loaded, now we check whether the entire range is loaded to determine //if we can safely invalidate if(grid.isGrouped){ //isc.Log.logInfo("in getGridDataSet invalidating cache, calling ungroup"); grid.ungroup(); } //isc.Log.logInfo("in getGridDataSet, calling invalidateCache"); dataSet.invalidateCache(); //isc.Log.logInfo("in getGridDataSet invalidating cache done"); } } if((checkIfAllDataLoaded==null || checkIfAllDataLoaded) && !allDataLoaded){ //isc.Log.logInfo("all data not loaded, returning null"); dataSet=null; } return dataSet; } isc.Menu.create({ ID:"animalMenu", showKeys:true, data:[ {title:"Add", click:function () {showQuickAddGrid();}} ] }); ListGrid.create({ ID:"animalsGrid", dataSource:"animals", canEdit:false, contextMenu:animalMenu, virtualScrolling:false, selectionType:"none", recordClick : function (viewer, record, recordNum, field, fieldNum, value, rawValue) { nextRecord=record; showDetails(); }, headerHeight: 36 }) isc.ListGrid.create({ ID: "quickAddGrid", headerHeight: 36, height:400, width:400, listEndEditAction:"next", canSort:false, canHover:true, hoverWidth:150, hoverHeight:50, hoverAlign:"left", hoverVAlign:"center", stopOnErrors:true, canEdit:false, headerButtonProperties:{ hoverWidth:200, hoverHeight:100, hoverAlign:"left", hoverVAlign:"center" }, canEdit:true, autoSize: true, autoSaveEdits:true, alternateRecordStyles: true, editComplete:function(rowNum,colNum,newValues,oldValues,editCompletionEvent,dsResponse){ var dataSet = getGridDataSet(animalsGrid); isc.Timer.setTimeout("quickAddGrid.startEditingNew();",0); }, dataSource:animals }); isc.TabSet.create({ ID:"animalTabs", height:380, tabs:[ {title:"Games", pane:animalMessage, ID:"animalGamesTab", width:70}, {title:"Notes", pane:animalMessage, ID:"animalNotesTab", width:70}, {title:"Food", pane:animalMessage, ID:"animalFoodTab", width:70}, {title:"Details", pane:animalMessage, ID:"animalDetailsTab", width:70} ] }); <%-- right-side layout--%> isc.SectionStack.create({ ID:"rightSections", overflow:"auto", className:"borderBR", visibilityMode:"multiple", backgroundColor:"white", sections:[ {title:"View Options", expanded:true,resizeable:false, items:[{children:[findAnimalsForm],height:30}]}, {title:"Grid", canCollapse:false, expanded:true, items:[animalsGrid]}, {title:"Detail", resizeable:false, expanded:true, items:[animalTabs]} , {title:"Welcome", canCollapse:false,expanded:true, items:[animalMessage6]} ] }); <%-- fund sections--%> isc.SectionStack.create({ID:"animalProfileSections", className:"borderBR", visibilityMode:"multiple", backgroundColor:"white", sections:[ { expanded:true, items:[animalMessage2],showHeader:false}, { expanded:true, items:[animalMessage3],showHeader:false} ] }) <%-- left-side layout--%> isc.SectionStack.create({ID:"leftSections", showResizeBar:true, visibilityMode:"multiple", width:250, className:"borderBL", sections:[ {title:"Left", canCollapse:false, expanded:true, items:[animalProfileSections]} ] }) <%-- **************overall page layout ************************--%> isc.VLayout.create({ ID:"pageLayout", width:"100%", height:"100%", members:[ animalMessage4, isc.HLayout.create({ ID:"mainLayout", layoutMargin:5, members:[ leftSections, rightSections ] }) ] }); function showDetails() { var record = nextRecord; if(!rightSections.sectionIsExpanded(2) ){ isc.Timer.setTimeout( "rightSections.expandSection(2);", 0 ); } animalTabs.updateTab(animalTabs.getTabObject("animalGamesTab"),animalGamesSections); animalTabs.updateTab(animalTabs.getTabObject("animalNotesTab"),animalMessage7); animalTabs.updateTab(animalTabs.getTabObject("animalFoodTab"),animalMessage8); animalTabs.updateTab(animalTabs.getTabObject("animalDetailsTab"),animalMessage9); isc.Timer.setTimeout( "animalsGrid.scrollRecordIntoView(" + animalsGrid.getRecordIndex(record) + ")", 0 ); } //helper method to copy object properties from one object to another--%> function copyObjectProperties(originObj,destObj, dataSourceName){ if(destObj==null){ destObj={}; } var originKeys = isc.getKeys(originObj); var j = originKeys.length; for (var i = 0; i < j; i++){ var key = originKeys[i]; //append test to cause value to change destObj[key] = originObj[key] + " test" } } function updateGridData(){ var record = animalsGrid.getRecord(1); record.continent1="test data"; record.continent2="test data"; record.continent3="test data"; record.continent4="test data"; record.continent5="test data"; record.continent6="test data"; record.continent7="test data"; record.continent8="test data"; record.continent9="test data"; record.continent10="test data"; record.continent11="test data"; record.continent12="test data"; record.continent13="test data"; record.continent14="test data"; record.continent15="test data"; record.continent16="test data"; record.continent17="test data"; record.continent18="test data"; record.continent19="test data"; record.continent20="test data"; record.continent21="test data"; record.continent22="test data"; record.continent23="test data"; record.continent24="test data"; record.continent25="test data"; record.continent26="test data"; record.continent27="test data"; record.continent28="test data"; record.continent29="test data"; record.continent30="test data"; record.continent31="test data"; record.continent32="test data"; record.continent33="test data"; record.continent34="test data"; record.continent35="test data"; record.continent36="test data"; record.continent37="test data"; record.continent38="test data"; record.continent39="test data"; record.continent40="test data"; record.continent41="test data"; record.continent42="test data"; record.continent43="test data"; record.continent44="test data"; record.continent45="test data"; record.continent46="test data"; record.continent47="test data"; record.continent48="test data"; record.continent49="test data"; record.continent50="test data"; record.continent51="test data"; record.continent52="test data"; record.continent53="test data"; record.continent54="test data"; record.continent55="test data"; record.continent56="test data"; record.continent57="test data"; record.continent58="test data"; record.continent59="test data"; record.continent60="test data"; record.continent61="test data"; record.continent62="test data"; record.continent63="test data"; record.continent64="test data"; record.continent65="test data"; record.continent66="test data"; record.continent67="test data"; record.continent68="test data"; record.continent69="test data"; record.continent70="test data"; record.continent71="test data"; record.continent72="test data"; record.continent73="test data"; record.continent74="test data"; record.continent75="test data"; record.continent76="test data"; record.continent77="test data"; record.continent78="test data"; record.continent79="test data"; record.continent80="test data"; record.continent81="test data"; record.continent82="test data"; record.continent83="test data"; record.continent84="test data"; record.continent85="test data"; record.continent86="test data"; record.continent87="test data"; record.continent88="test data"; record.continent89="test data"; record.continent90="test data"; record.continent91="test data"; record.continent92="test data"; record.continent93="test data"; record.continent94="test data"; record.continent95="test data"; record.continent96="test data"; record.continent97="test data"; record.continent98="test data"; record.continent99="test data"; record.continent90="test data"; record.continent91="test data"; record.continent92="test data"; record.continent93="test data"; record.continent94="test data"; record.continent95="test data"; record.continent96="test data"; record.continent97="test data"; record.continent98="test data"; record.continent99="test data"; record.continent100="test data"; record.continent101="test data"; record.continent102="test data"; record.continent103="test data"; record.continent104="test data"; record.continent105="test data"; record.continent106="test data"; record.continent107="test data"; record.continent108="test data"; record.continent109="test data"; record.continent110="test data"; record.continent111="test data"; record.continent112="test data"; record.continent113="test data"; record.continent114="test data"; record.continent115="test data"; record.continent116="test data"; record.continent117="test data"; record.continent118="test data"; record.continent119="test data"; record.continent120="test data"; record.continent121="test data"; record.continent122="test data"; record.continent123="test data"; record.continent124="test data"; record.continent125="test data"; record.continent126="test data"; record.continent127="test data"; record.continent128="test data"; record.continent129="test data"; record.continent130="test data"; record.continent131="test data"; record.continent132="test data"; record.continent133="test data"; record.continent134="test data"; record.continent135="test data"; record.continent136="test data"; record.continent137="test data"; record.continent138="test data"; record.continent139="test data"; record.continent140="test data"; record.continent141="test data"; record.continent142="test data"; record.continent143="test data"; record.continent144="test data"; record.continent145="test data"; record.continent146="test data"; record.continent147="test data"; record.continent148="test data"; record.continent149="test data"; record.continent150="test data"; record.continent151="test data"; record.continent152="test data"; record.continent153="test data"; record.continent154="test data"; record.continent155="test data"; record.continent156="test data"; record.continent157="test data"; record.continent158="test data"; record.continent159="test data"; var record2 = isc.clone(record); copyObjectProperties(record2,record); } function updateFindAnimalsForm(){ findAnimalsForm.setFields( [ {type:"staticText", showIf:" return false;",shouldSaveValue:false}, {name:"search"}, {type: "button", showIf:" return false;",width:200, title:"Ungroup, No Update, Redraw",click:function(){ isc.say("redrawing..."); if(animalsGrid.isGrouped){ animalsGrid.ungroup(); } //do not call updateGridData here //updateGridData(); animalsGrid.redraw(); isc.say('redraw complete'); } }, {type: "button", showIf:" return false;",width:200, title:"Ungroup, Update, and Redraw",click:function(){ isc.say("updating data and redrawing..."); if(animalsGrid.isGrouped){ animalsGrid.ungroup(); } //call updateGridData here which causes updateGridData(); animalsGrid.redraw(); isc.say('updating data and redraw complete'); } }, {type: "button", showIf:" return false;", width:200, title:"Group, Update, Redraw",click:function(){ isc.say("grouping, updating data, and redrawing..."); if(!animalsGrid.isGrouped){ animalsGrid.groupBy("information"); } //call updateGridData here which causes updateGridData(); animalsGrid.redraw(); isc.say('group, updating data, and redraw complete'); } } ] ); } function updateAnimalsGrid(){ animalsGrid.setFields([ {name:"commonName"}, {name:"scientificName"}, {name:"lifeSpan"}, {name:"information"}, {name:"information2", showIf:"return false;"}, {name:"continent1", showIf:"return false;"}, {name:"continent2", showIf:"return false;"}, {name:"continent3", showIf:"return false;"}, {name:"continent4", showIf:"return false;"}, {name:"continent5", showIf:"return false;"}, {name:"continent6", showIf:"return false;"}, {name:"continent7", showIf:"return false;"}, {name:"continent8", showIf:"return false;"}, {name:"continent9", showIf:"return false;"}, {name:"continent10", showIf:"return false;"} ] ) } function updateQuickAddGrid(){ quickAddGrid.cancelEditing(); quickAddGrid.discardAllEdits(); quickAddGrid.markForRedraw(); var animalResultSet = isc.ResultSet.create({ dataSource: animals, initialData: [], criteria: {} }); quickAddGrid.setData(animalResultSet); quickAddGrid.setFields([ {name:"scientificName",required:true}, {name:"commonName"}, {name:"lifeSpan"}, {name:"status"} ] ) } function stripTags(str) { if(str!=null && isA.Function(str.split)){ //add logic to preserve <br> by converting to \n charcters and then back str=str.replaceAll("<br/>","\n"); str=str.replaceAll("<br>", "\n"); //convert other representations of open and close tag //to their text equivalents first str=str.replaceAll("<","<"); str.replaceAll(">",">"); str=str.replaceAll("<","<"); str.replaceAll(">",">"); str=str.replaceAll("<","<"); str.replaceAll(">",">"); str=str.replaceAll("<","<"); str.replaceAll(">",">"); } if(str!=null && isA.Function(str.replace)){ var returnString = str.replace(/<\/?[^>]+>/gi, ''); //comment out logic that preserves breaks until iso fixed fixedRecordHeight issue with Firefox //returnString = returnString.replaceAll("\n","<br/>"); return returnString; }else{ return str; } } function stripDSFields(data,dsFields,deleteNullFields,deleteDisplayOnly, keepExportFieldsOnly){ //remove any Datasource fields from data object for DSRequest --%> var keys = isc.getKeys(data); var j = keys.length; for (var i = 0; i < j; i++){ var key = keys[i]; var dsField = dsFields[key]; //strip out html tags so they don't get into db if(dsField!=null && dsField.type!=null && ( dsField.type.toLowerCase()=="text")){ var value = isc.getValueForKey(key,data); if(value!=null && value!=key){ value = stripTags(value,true); data[key]=value; } } //if we are keeping export fields and this is one, continue without removing if(keepExportFieldsOnly){ if(dsField!=null && dsField.exportField){ continue; }else{ delete data[key]; } } //delete all fields that are not defined as datasource fields if((deleteNullFields==null || deleteNullFields) && dsField==null){ delete data[key]; continue; } //remove any client-side or display only //attributes and any fields that are part of another datasource--%> if(dsField!=null && (isc.DataSource.getDataSource(dsField.type)!=null || ((deleteDisplayOnly==null || deleteDisplayOnly) && dsField.displayOnly))){ delete data[key]; } } return data; } function initPageLayout(){ updateAnimalGamesSave() updateAnimalGamesSummary(); updateAnimalGamesEditor(); updateAnimalDataEditor(); updateFindAnimalsForm() updateAnimalsGrid(); pageLayout.draw(); //rightSections.showSection(0); rightSections.showSection(1); rightSections.showSection(2); rightSections.hideSection(3); rightSections.collapseSection(2); at.initialLayoutComplete=true; //isc.Timer.setTimeout("animalsGrid.groupBy('information');",4000); } function initialDataLoad(data,dsRequest){ createAnimalResultSet(data,dsRequest,data,true); initPageLayout(); } function createAnimalResultSet(data,dsRequest,data,initialLoad){ var animalResultSet = isc.ResultSet.create({ dataSource: animals, initialData: data, criteria: dsRequest.data ,neverDropUpdatedRows:true }); animalsGrid.setData(animalResultSet); } animals.fetchData({status:"Threatened",lifeSpan:10},"initialDataLoad(data,dsRequest);"); function formatNumber (anynum, decimal,label,labelPosition,adjustDecimal, divideBy) { if(anynum == null || !isNumber(anynum)){ //4/28/11.try to convert to number before failing anynum = Number(anynum); if(!isNumber(anynum)){ return LABEL_NA; } } if(divideBy!=null){ anynum = anynum/divideBy; } var divider =10; switch(decimal){ case 0: divider =1; break; case 1: divider =10; break; case 2: divider =100; break; case 3: divider =1000; break; case 4: divider =10000; break; case 5: divider =100000; break; case 6: divider =1000000; break; case 7: divider =10000000; break; case 8: divider =100000000; break; default: //for 3 decimal places--%> divider =1000; } var workNum=Math.abs((Math.round(anynum*divider)/divider)); var workStr=""+workNum if (workStr.indexOf(".")==-1){workStr+="."} var dStr=workStr.substr(0,workStr.indexOf(".")); var dNum=dStr-0; var pStr=workStr.substr(workStr.indexOf(".")); //only fix the decimals if the adjustDecimal param is set to false--%> if(adjustDecimal!=null && !adjustDecimal){ while (pStr.length-1< decimal){pStr+="0"} } if(pStr =='.') pStr =''; // Adds a comma in the thousands place.--%> if (dNum>=1000) { var dLen=dStr.length dStr=parseInt(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen) } // Adds a comma in the millions place.--%> if (dNum>=1000000) { dLen=dStr.length dStr=parseInt(""+(dNum/1000000))+","+dStr.substring(dLen-7,dLen) } // Adds a comma in the billions place--%> if (dNum>=1000000000) { dLen=dStr.length dStr=parseInt(""+(dNum/1000000000))+","+dStr.substring(dLen-11,dLen) } // Adds a comma in the trillions place.--%> if (dNum>=1000000000000) { dLen=dStr.length dStr=parseInt(""+(dNum/1000000000000))+","+dStr.substring(dLen-15,dLen) } if (dNum>=1000000000000000) { dLen=dStr.length dStr=parseInt(""+(dNum/1000000000000000))+","+dStr.substring(dLen-19,dLen) } if (dNum>=1000000000000000000) { dLen=dStr.length dStr=parseInt(""+(dNum/1000000000000000000))+","+dStr.substring(dLen-23,dLen) } if (dNum>=1000000000000000000000) { dLen=dStr.length dStr=parseInt(""+(dNum/1000000000000000000000))+","+dStr.substring(dLen-27,dLen) } var retval = dStr + pStr if(labelPosition != null && label != null && label!=""){ if(labelPosition == "before"){ retval = label + retval; } else { retval = retval + " " + label; } } // Put numbers in parentheses if negative.--%> if (anynum<0) { retval="("+retval+")"; } return retval; } function isNumber(value) { isc.Log.logInfo("typeof value=" + typeof value); return typeof value === 'number' && isFinite(value); } </SCRIPT> </BODY></HTML>
Comment