Skip to content

Instantly share code, notes, and snippets.

function multiplyByTwo(a, b, c) {
var i, ar = [];
for(i = 0; i < 3; i++) {
ar[i] = arguments[i] * 2;
}
return ar;
}
multiplyByTwo(1, 2, 3);
[2, 4, 6]
break point
myDDEditor.subscribe("showEvent", DDcallback);
step into
utilities.js
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];
// User Dropdown Custom Formatter
YAHOO.widget.DataTable.Formatter.lookup = function(elCell, oRecord, oColumn, oData) {
var lookupTable = oColumn.lookupTable || (oColumn.editor instanceof YAHOO.widget.DropdownCellEditor) && oColumn.editor.dropdownOptions;
if (YAHOO.lang.isArray(lookupTable)) {
for (var i = 0; i < lookupTable.length; i++) {
if (lookupTable[i].value === oData) {
elCell.innerHTML = lookupTable[i].label;
return;
}
http://techdocs.local/db_taskmanager.php?action=select-usersDataSource%20instance0
var handleSuccess = function(o){
alert("success");
};
var handleFailure = function(o){
alert("failure");
var DDcallback =
{
success: DDhandleSuccess,
failure: DDhandleFailure
};
var DDhandleSuccess = function(o){
if(o.responseText !== undefined){
var response = o.responseText;
alert(response);
1. declare the URL
2. define the handleSuccess function which:
1. Uses the JSON utility to decode the dropdownOptions from o.responseText
2. declares the editors
3. builds the column defs
4. creates the DataSource
5. creates the DataTable
3. define the handleFailure
4. define the callback
5. call asyncRequest
var revealingModulePattern = function(){
var privateVar = 1;
function privateFunction(){
alert('private');
};
var publicVar = 2;
function publicFunction(){
anotherPublicFunction();
};
function anotherPublicFunction(){
You can even return values as the public properties by calling the functions in the anonymous object:
var revealingModulePattern = function(){
var privateVar = 1;
function privateFunction(){
alert('private');
};
var publicVar = 2;
function publicFunction(){
create a place to store references to each dropdown, just an object literal or something, make each entry initially null ,
when the success function of each async returns set up the dropdown and stick it into the right spot on the object literal,
then call a function at the end of each success that checks the object literal,
if there's any null values it does nothing, otherwise everything is done & it starts setting up the datatable,
I don't know a ton about how to set up cell editors like that so it's entirely possible you could be setting up the DT while the async calls are waiting
SELECT F1.item_nbr, F1.cost,
(SELECT MAX(F2.cost)
FROM Foobar AS F2
WHERE F1.item_nbr = F2.item_nbr) AS grp_max
FROM Foobar AS F1
ORDER BY grp_max DESC, F1.cost DESC