Tuesday, August 28, 2012

From the depths of SharePoint's sp.js Pt. 2

So I lied... :)  The function found below is a part of core.js.

A good ol' fashioned
console.dir( GetCurrentCtx().clvp );
generates this bit of awesome:

{

 ctx : [object Object],

 tab : [object],

 pagingTab : null,

 tBody : null,

 wpq : "WebPartWPQ4",

 inplUrl : "http://portal/SPDev/_layouts/inplview.aspx?List={49AFC299-FC30-4EE9-9571-50B3B366969E}&View={876230CC-BE1A-4845-8998-652BB77C891C}&ViewCount=7&ListViewPageUrl=http://portal/SPDev/pages/spUtils.aspx&IsXslView=TRUE",

 trEmpty : null,

 rootFolder : null,

 rootFolderGuid : null,

 rgpag : null,

 wpid : null,

 isEditing : false,

 dsrc : null,

 isInserting : false,

 strGroupName : null,

 strGroupCache : null,

 bRequestOutstanding : false,

 isEcbInfo : false,

 queueEcbInfo : ,

 fnEcbCallback : null,

 rgpaging : ,

 focusInfo : null,

 CUIItemInfo : [object Object],

 Init : function CLVPInit(){ULSiIp:;var f=this.ctx.listBaseType==1,d;if(this.ctx.listTemplate=="109"){this.ctx.clvp=null;return}d=this.ctx.listName+"-"+this.ctx.view;var b=GetElementsByName(d);if(b.length==0&&f){d="onetidDoclibViewTbl0";b=GetElementsByName(d)}va,

 RestoreNavigation : function CLVPRestoreNavigation(){ULSiIp:;var a=window.location.hash,c=this.InplViewUrl(),b=this.RefreshCurrent(true);b=b.substr(c.length+1);if(a.indexOf("InplviewHash=")==1){a=DecodeHashAsQueryString(a);var d=a.substr(14,38);if(d!=this.ctx.view)return;a=,

 FindWebPartDiv : function CLVPFindWebPartDiv(b){ULSiIp:;var a=b;while(a!=null&&a.tagName!="DIV")a=a.parentNode;return a},

 SyncPagingTables : function CLVPSyncPagingTables(){ULSiIp:;var b=this.pagingTab,a=document.getElementById("topPagingCell"+this.wpq.substr(7));if(b==null){if(a!=null)a.style.display="none";return}if(a!=null){a.style.display="";if(GetInnerText(a)!=GetInnerText(b))a.innerHTML,

 RehookPaging : function CLVPRehookPaging(){ULSiIp:;if(typeof this.ctx.noAJAX!="undefined"&&this.ctx.noAJAX)return;var tab=this.pagingTab;if(tab==null){this.SyncPagingTables();return}for(var lnks=tab.getElementsByTagName("A"),i=0;i<lnks.length;i++){var lnk=lnks[i],str=",

 FilterString : function CLVPFilterString(){ULSiIp:;if(this.rgpaging==null)return null;var a,d,b=[],c=true;for(a in this.rgpaging)if(a.indexOf("Filter")==0||a.indexOf("Sort")==0){if(c)c=false;else b.push("&");b.push(a);b.push("=");b.push(this.rgpaging[a])}return b.join(,

 RefreshPaging : function CLVPRefreshPaging(c,a,b){ULSiIp:;if(a!=null)this.tBody=document.getElementById(a);var d=this.isEditing?"JsGrid":null;return this.RefreshPagingEx(c,true,d,b)},

 RefreshPagingEx : function CLVPRefreshPagingEx(e,q,p,t){ULSiIp:;var s=GetUrlKeyValue("PageFirstRow",false,e)=="1";if(s)e=RemoveOnlyPagingArgs(e);var v=new CUrl(e),h=v.query;if(h.length>0)h=h.substr(1);var i=h.split("&"),f,a=[];if(p!=null)a.push("&Cmd="+p);else this.isEdit,

 ResetSelection : function CLVPResetSelection(){ULSiIp:;var a=this.ctx,f=true;this.CUIItemInfo=null;if(CountSelectedItems(a)>0){var h=a.dictSel;a.dictSel=[];a.CurrentSelectedItems=0;var g=window.location.href;if(g.indexOf("Filter")==-1&&g.indexOf("Sort")==-1){var d=this.t,

 WebPartId : function CLVPWebPartId(){ULSiIp:;if(this.wpid==null){if(this.tab!=null){var a=this.tab;a=GetAncestor(a,"DIV");if(a!=null){if(a.getAttribute("WebPartID2")!=null){this.wpid=a.getAttribute("WebPartID2");return this.wpid}if(a.getAttribute("WebPartID")!=null),

 RefreshCore : function CLVPRefreshCore(strUrl){ULSiIp:;MenuHtc_hide();var req;if(window.XMLHttpRequest)req=new XMLHttpRequest;else req=new ActiveXObject("Microsoft.XMLHTTP");var additionalPostData="";if(typeof this.ctx.overrideSelectCommand!="undefined"){additionalPos,

 RefreshCurrent : function CLVPRefreshCurrent(){ULSiIp:;var a=document.URL;STSNavigate(a)},

 GetQueryString : function CLVPGetQueryString(){ULSiIp:;if(this.tab!=null&&this.tab.getAttribute("FilterLink")!=null)return this.tab.getAttribute("FilterLink");else return document.URL},

 RefreshEcbInfo : function CLVPRefreshEcbInfo(b){ULSiIp:;var a=this.GetQueryString();a=FixUrlFromClvp2(this,a,false);this.isEcbInfo=true;this.strGroupName=b;var c=this;this.RefreshPagingEx(a,false,"EcbView")},

 CacheEcbInfo : function CLVPCacheEcbInfo(b){ULSiIp:;if(this.ctx.HasRelatedCascadeLists==1&&this.ctx.CascadeDeleteWarningMessage==null){var j="<CascadeDeleteWarningMessage>",k="</CascadeDeleteWarningMessage>";if(b.startsWith(j)){var g=b.indexOf(k);if(g!==-1){this.ctx.Ca,

 EnsureEcbInfo : function CLVPEnsureEcbInfo(c,f,a){ULSiIp:;var g="ecbtab_ctx"+this.ctx.ctxId,b=document.getElementById(g);if(b==null&&this.tab!=null&&this.tab.parentNode==null)for(var d=0;d<this.tab.childNodes.length;d++){var e=this.tab.childNodes[d];if(e.id==g)b=e}if(b&,

 InvalidateEcbInfo : function CLVPInvalidateEcbInfo(){ULSiIp:;var b="ecbtab_ctx"+this.ctx.ctxId,a=document.getElementById(b);if(a!=null){this.tab.removeChild(a);this.DeleteGroupNameCache()}},

 GetEcbInfo : function CLVPGetEcbInfo(b){ULSiIp:;var a=this.EnsureEcbInfo();if(a!=null)if(a.dict!=null)return a.dict[b];return null},

 SwitchToEdit : function CLVPSwitchToEdit(){ULSiIp:;var a=document.URL;a=FixUrlFromClvp2(this,a,false);this.RefreshPagingEx(a,false,"JsGrid")},

 EnsureChangeContext : function CLVPEnsureChangeContext(){ULSiIp:;if(this.cctx==null)this.cctx=new SP.ClientContext(null)},

 DeleteItemCore : function CLVPDeleteItemCore(c,f){ULSiIp:;var h=this.ctx.listBaseType==1;this.EnsureChangeContext();var a=null;if(typeof this.rgehs=="undefined")this.rgehs=[];var b,e;b=new SP.ExceptionHandlingScope(this.cctx);this.rgehs.push(b);e=b.startScope();this.cctx,

 CheckoutItem : function CLVPCheckoutItem(f,d){ULSiIp:;this.EnsureChangeContext();if(typeof this.rgehs=="undefined")this.rgehs=[];var a,c,b=null;if(d!=0)return;a=new SP.ExceptionHandlingScope(this.cctx);this.rgehs.push(a);c=a.startScope();b=this.cctx.get_web().get_lists,

 DiscardCheckoutItem : function CLVPDiscardCheckoutItem(e,g){ULSiIp:;this.EnsureChangeContext();if(typeof this.rgehs=="undefined")this.rgehs=[];var b=null,a,f;if(g!=0)return;a=new SP.ExceptionHandlingScope(this.cctx);this.rgehs.push(a);f=a.startScope();b=this.cctx.get_web().ge,

 CheckinItem : function CLVPCheckinItem(g,j,a){ULSiIp:;this.EnsureChangeContext();if(typeof this.rgehs=="undefined")this.rgehs=[];var c=null,b,h;if(j!=0)return;b=new SP.ExceptionHandlingScope(this.cctx);this.rgehs.push(b);h=b.startScope();c=this.cctx.get_web().get_list,

 ManageCopies : function CLVPManageCopies(f,e){ULSiIp:;if(e!=0)return;var b=this.GetEcbInfo(f);if(b!=null&&b.getAttribute("Url")!=null){var d=this.ctx.HttpRoot+"/_layouts/managecopies.aspx?ItemUrl="+b.getAttribute("Url")+"&Source="+GetSource(),a=window["ctx"+this.ctx.ct,

 ShowErrorDialog : function CLVPShowErrorDialog(g){ULSiIp:;var i,a=[],d=null,c=false;for(i in this.rgehs){var b=this.rgehs[i];if(b.get_hasException()){var f="s4-dlg-err-itm";if(!c){f="s4-dlg-err-firstitm";c=true;a.push(SP.Res.dlgTitleError)}var k=b.get_errorMessage();a.pus,

 InplViewUrl : function CLVPInplViewUrl(){ULSiIp:;if(this.inplUrl!=null)return this.inplUrl;var a=[],b=escapeUrlForCallback(this.ctx.HttpRoot);a.push(b);b[b.length-1]!="/"&&a.push("/");a.push("_layouts/inplview.aspx?List=");a.push(this.ctx.listName);if(this.ctx.view!=n,

 InplViewUrlTrim : function CLVPInplViewUrlTrim(a){ULSiIp:;var b="";if(a)if(typeof this.ctx.overrideFilterQstring!="undefined")b=a.substr(this.InplViewUrl().length-this.ctx.overrideFilterQstring.length);else b=a.substr(this.InplViewUrl().length+1);return b},

 ShowPopup : function CLVPShowPopup(a){ULSiIp:;MenuHtc_hide();if(typeof this.fnOnCommitPopup!="undefined"&&this.fnOnCommitPopup!=null)OpenPopUpPage(a,this.fnOnCommitPopup);else OpenPopUpPage(a,RefreshPage);return false},

 ValidateField : function CLVPValidateField(e,d,a,b){ULSiIp:;var c=this.FieldCommand("FldValidate",e,d,a,b),f={callback:a,newval:b,strCmd:c};if(this.qvalidate==null)this.qvalidate=[];this.qvalidate.push(f);if(!this.isValidating){this.isValidating=true;this.RefreshCore(c),

 FieldCommand : function CLVPFieldCommand(j,h,d,m,f){ULSiIp:;var a=[];a.push(this.InplViewUrl());a.push("&Cmd=");a.push(j);a.push("&Field=");a.push(d);a.push("&FieldValue=");var b=h.GetProp(d),c,n=this.gridParam.tableViewParams.columns.GetColumnByKey(d),k=jsGridParams.t,

 IsInGroupCache : function CLVPIsInGroupCache(a){ULSiIp:;if(this.strGroupCache==null)return false;return this.strGroupCache.indexOf(a+"$")!=-1},

 CacheGroupName : function CLVPCacheGroupName(a){ULSiIp:;if(this.strGroupCache==null)this.strGroupCache=a+"$";else this.strGroupCache=this.strGroupCache+a+"$"},

 DeleteGroupNameCache : function CLVPDeleteGroupNameCache(){ULSiIp:;if(this.strGroupCache==null)return;var b=0,a;a=this.strGroupCache.indexOf("$",b);while(a!=-1){var d=this.strGroupCache.substring(b,a),e="ecbtab_ctx"+this.ctx.ctxId+"_"+d,c=document.getElementById(e);c&&this.tab,

 EnqueueEcbInfoRequest : function CLVPEnqueueEcbInfoRequest(b){ULSiIp:;for(var a=0;a<this.queueEcbInfo.length;a++)if(this.queueEcbInfo[a]==b)return;this.queueEcbInfo.push(b)},

 NoOutstandingECBRequests : function CLVPNoOutstandingECBRequests(){ULSiIp:;if(this.isEcbInfo)return false;if(this.queueEcbInfo.length>0)return false;return true}

}

That makes a bunch of noise, however, you'll see an interesting URL at the property named: inplUrl. 
Upon visiting this URL, you'll see all of your data for that particular view.  This seems very attractive for AJAX applications in SharePoint.  Look for more to come in regards to this...

Cheers,
Matthew