/
JavaScriptAPI
JavaScriptAPI
CustomizeBehaviourMashup.js
// --- DocsFree Sheetster ECMAScript API --------------------------- // For more information see: // http://extentech.com/uimodules/docs/docs_home.jsp?meme_id=2305 // ----------------------------------------------------------------- /* Copyright (c) 2011 Extentech Inc. All Rights Reserved ##### Sheetster™ Web Application ##### This file is a part of the Sheetster™ Web Application * */ /** This example demonstrates: - Spreadsheet manipulation - Mashup google maps - Override of built-in functionality To use this example: * * Login to Sheetster * Create a New Spreadsheet * Under Developer Tab, click "Edit Doc App " * Paste code into the Scripting window and hit "Run Script" */ /* getMap function will open Google Maps and set to coordinates in cells. 37.761, -122.4638 */ function getMap(){ // get latitude and longitude from cells var clat = book.getSelectedSheet().getCell("C4"); clat.setVal('37.761'); var clong = book.getSelectedSheet().getCell("C5"); clong.setVal('-122.4638'); // navigate to longitude book.cursor.setFocus(clong); // create google maps url var mapurl = "http://maps.google.com/maps/api/staticmap?center="+clat.getVal()+","+clong.getVal()+"&zoom=14&size=512x512&maptype=roadmap&sensor=false"; parent.createWindow("mapped",mapurl,"extentech"); } // call the map function getMap(); // save original setCursorLocation function book.cursor.setCursorLocationOLD = book.cursor.setCursorLocation; // override default cell click behavior book.cursor.setCursorLocation = function(){ // book.cursor.setCursorLocationOLD alert('clicked on: ' + book.cursor.getLocation() ); };
FormEvents.js
// --- DocsFree Sheetster ECMAScript API --------------------------- // For more information see: // http://extentech.com/uimodules/docs/docs_home.jsp?meme_id=2305 // ----------------------------------------------------------------- /* Copyright (c) 2011 Extentech Inc. All Rights Reserved ##### Sheetster™ Web Application ##### This file is a part of the Sheetster™ Web Application * */ /** This example demonstrates: - Form opening - Form submit handling - Form validations To use this example: * * 1. Login to Sheetster * 2. Create a New Spreadsheet * 3. Create a Form named 'testform' using the form definition: * * TEST * First Name, fn, Enter your first name, na * First Name, fn, Enter your first name, na * First Name, fn, Enter your first name, na * onsubmit, parent.formSubmitAction() * * For info on creating Sheetster Forms see the following article: * http://extentech.com/uimodules/docs/docs_home.jsp?meme_id=1873 * * 4. Under Developer Tab, click "Create App" * 5. Paste code into the Scripting window and hit "Run Script" // --- DocsFree Sheetster ECMAScript API --------------------------- // For more information see: // http://extentech.com/uimodules/docs/docs_home.jsp?meme_id=2305 // ----------------------------------------------------------------- */ var formurl = '/workbook/id/2/html/namedrange/getform/testform'; // write to the debug window debug('hello world!'); // open the form parent.createDialogWindow("mapped",formurl,"extentech"); /** * performs some action after the form submittal * */ function formSubmitAction(){ alert('thanks!'); } /** * performs a validation on the form values as they are entered * * @param {Object} val */ function validate(val){ alert("Value is OK:" + val.getValue()); }