1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
|
(function(e){var b=e.telerik;var c=/"\\\/Date\((.*?)\)\\\/"/g;function d(f){return new Function("data",("var p=[];with(data){p.push('"+unescape(f).replace(/[\r\t\n]/g," ").replace(/'(?=[^#]*#>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<#=(.+?)#>/g,"',$1,'").split("<#").join("');").split("#>").join("p.push('")+"');}return p.join('');"))}function a(f){return(f!=null?f+"":"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}b.grid=function(f,g){this.element=f;this.groups=[];this.editing={};this.filterBy="";this.groupBy="";this.orderBy="";e.extend(this,g);this.sorted=e.grep(this.columns,function(i){return i.order});this.$tbody=e("> .t-grid-content > table tbody",f);this.scrollable=this.$tbody.length>0;if(!this.scrollable){this.$tbody=e("> table > tbody",f);this.$header=e("> table > thead tr",f);this.$footer=e("> table > tfoot",f)}else{this.$header=e("> .t-grid-header tr",f);this.$footer=e("> .t-grid-footer",f)}this.$footerWrap=this.$footer.find(".t-footer-template-wrap");var l=this.$headerWrap=e("> .t-grid-header > .t-grid-header-wrap",f);e("> .t-grid-content",f).bind("scroll",function(){l.scrollLeft(this.scrollLeft)});this.$tbody.delegate(".t-hierarchy-cell .t-plus, .t-hierarchy-cell .t-minus","click",b.stopAll(function(p){var o=e(p.target);var n=o.hasClass("t-plus");o.toggleClass("t-minus",n).toggleClass("t-plus",!n);var i=o.closest("tr.t-master-row");if(this.detail&&!i.next().hasClass("t-detail-row")){e(new b.stringBuilder().cat('<tr class="t-detail-row">').rep('<td class="t-group-cell"></td>',i.find(".t-group-cell").length).cat('<td class="t-hierarchy-cell"></td>').cat('<td class="t-detail-cell" colspan="').cat(this.$header.find("th:not(.t-group-cell,.t-hierarchy-cell):visible").length).cat('">').cat(this.displayDetails(this.dataItem(i))).cat("</td></tr>").string()).insertAfter(i)}b.trigger(this.element,n?"detailViewExpand":"detailViewCollapse",{masterRow:i[0],detailRow:i.next(".t-detail-row")[0]});i.next().toggle(n)},this));this.$pager=e("> .t-pager-wrapper .t-pager",f).add(this.$footer.find(".t-pager"));this.$pager.delegate(".t-state-disabled","click",b.preventDefault).delegate(".t-link:not(.t-state-disabled)","mouseenter",b.hover).delegate(".t-link:not(.t-state-disabled)","mouseleave",b.leave).delegate("input[type=text]","keydown",e.proxy(this.pagerKeyDown,this));this.$footer.add(e("> .t-pager-wrapper",f)).delegate(".t-refresh","click",e.proxy(this.refreshClick,this));e(f).delegate(".t-button","hover",b.preventDefault);if(this.sort){this.$header.delegate(".t-link","hover",function(){e(this).toggleClass("t-state-hover")})}var m="tr:not(.t-grouping-row,.t-detail-row,.t-no-data,:has(>.t-edit-container))";if(this.selectable){var k=this.$tbody[0];var j=this;this.$tbody.delegate(m,"click",function(i){if(this.parentNode==k){j.rowClick(i)}}).delegate(m,"hover",function(){if(this.parentNode==k){e(this).toggleClass("t-state-hover")}})}if(this.isAjax()){this.$pager.delegate(".t-link:not(.t-state-disabled)","click",b.stop(this.pagerClick,this));if(this.sort){this.$header.delegate(".t-link","click",b.stop(this.headerClick,this))}}for(var h=0;h<this.plugins.length;h++){b[this.plugins[h]].initialize(this)}b.bind(this,{columnResize:this.onColumnResize,columnReorder:this.onColumnReorder,"delete":this.onDelete,detailViewExpand:this.onDetailViewExpand,detailViewCollapse:this.onDetailViewCollapse,dataBinding:this.onDataBinding,dataBound:this.onDataBound,edit:this.onEdit,error:this.onError,load:this.onLoad,rowSelect:this.onRowSelect,rowDataBound:this.onRowDataBound,save:this.onSave});this.createColumnMappings()};b.grid.prototype={rowClick:function(h){var g=e(h.target);if(!g.is(":button,a,:input,a>.t-icon")){h.stopPropagation();var f=g.closest("tr").addClass("t-state-selected").siblings().removeClass("t-state-selected").end();b.trigger(this.element,"rowSelect",{row:f[0]})}},$rows:function(){return this.$tbody.find("> tr:not(.t-grouping-row,.t-detail-row)")},expandRow:function(f){e(f).find("> td .t-plus, > td .t-expand").click()},collapseRow:function(f){e(f).find("> td .t-minus, > td .t-collapse").click(
|