text: YUI.add("datatable-mutable",function(Y,NAME){var toArray=Y.Array,YLang=Y.Lang,isString=YLang.isString,isArray=YLang.isArray,isObject=YLang.isObject,isNumber=YLang.isNumber,arrayIndex=Y.Array.indexOf,Mutable;Y.namespace("DataTable").Mutable=Mutable=function(){},Mutable.ATTRS={autoSync:{value:!1,validator:YLang.isBoolean}},Y.mix(Mutable.prototype,{addColumn:function(config,index){isString(config)&&(config={key:config});if(config){if(arguments.length<2||!isNumber(index)&&!isArray(index))index=this.get("columns").length;this.fire("addColumn",{column:config,index:index})}return this},modifyColumn:function(name,config){return isString(config)&&(config={key:config}),isObject(config)&&this.fire("modifyColumn",{column:name,newColumnDef:config}),this},moveColumn:function(name,index){return name!==undefined&&(isNumber(index)||isArray(index))&&this.fire("moveColumn",{column:name,index:index}),this},removeColumn:function(name){return name!==undefined&&this.fire("removeColumn",{column:name}),this},addRow:function(data,config){var sync=config&&"sync"in config?config.sync:this.get("autoSync"),models,model,i,len,args;if(data&&this.data){models=this.data.add.apply(this.data,arguments);if(sync){models=toArray(models),args=toArray(arguments,1,!0);for(i=0,len=models.length;i<len;++i)model=models[i],model.isNew()&&models[i].save.apply(models[i],args)}}return this},removeRow:function(id,config){var modelList=this.data,sync=config&&"sync"in config?config.sync:this.get("autoSync"),models,model,i,len,args;isObject(id)&&id instanceof this.get("recordType")?model=id:modelList&&id!==undefined&&(model=modelList.getById(id)||modelList.getByClientId(id)||modelList.item(id));if(model){args=toArray(arguments,1,!0),models=modelList.remove.apply(modelList,[model].concat(args));if(sync){isObject(args[0])||args.unshift({}),args[0]["delete"]=!0,models=toArray(models);for(i=0,len=models.length;i<len;++i)model=models[i],model.destroy.apply(model,args)}}return this},modifyRow:function(id,data,config){var modelList=this.data,sync=config&&"sync"in config?config.sync:this.get("autoSync"),model,args;return isObject(id)&&id instanceof this.get("recordType")?model=id:modelList&&id!==undefined&&(model=modelList.getById(id)||modelList.getByClientId(id)||modelList.item(id)),model&&isObject(data)&&(args=toArray(arguments,1,!0),model.setAttrs.apply(model,args),sync&&!model.isNew()&&model.save.apply(model,args)),this},_defAddColumnFn:function(e){var index=toArray(e.index),columns=this.get("columns"),cols=columns,i,len;for(i=0,len=index.length-1;cols&&i<len;++i)cols=cols[index[i]]&&cols[index[i]].children;cols&&(cols.splice(index[i],0,e.column),this.set("columns",columns,{originEvent:e}))},_defModifyColumnFn:function(e){var columns=this.get("columns"),column=this.getColumn(e.column);column&&(Y.mix(column,e.newColumnDef,!0),this.set("columns",columns,{originEvent:e}))},_defMoveColumnFn:function(e){var columns=this.get("columns"),column=this.getColumn(e.column),toIndex=toArray(e.index),fromCols,fromIndex,toCols,i,len;if(column){fromCols=column._parent?column._parent.children:columns,fromIndex=arrayIndex(fromCols,column);if(fromIndex>-1){toCols=columns;for(i=0,len=toIndex.length-1;toCols&&i<len;++i)toCols=toCols[toIndex[i]]&&toCols[toIndex[i]].children;toCols&&(len=toCols.length,fromCols.splice(fromIndex,1),toIndex=toIndex[i],len>toCols.lenth&&fromIndex<toIndex&&toIndex--,toCols.splice(toIndex,0,column),this.set("columns",columns,{originEvent:e}))}}},_defRemoveColumnFn:function(e){var columns=this.get("columns"),column=this.getColumn(e.column),cols,index;column&&(cols=column._parent?column._parent.children:columns,index=Y.Array.indexOf(cols,column),index>-1&&(cols.splice(index,1),this.set("columns",columns,{originEvent:e})))},initializer:function(){this.publish({addColumn:{defaultFn:Y.bind("_defAddColumnFn",this)},removeColumn:{defaultFn:Y.bind("_defRemoveColumnFn",this)},moveColumn:{defaultFn:Y.bind("_defMoveColumnFn",this)},modifyColumn:{defaultFn:Y.bind("_defModifyColumnFn",this)}})}}),Mutable.prototype.addRows=Mutable.prototype.addRow,YLang.isFunction(Y.DataTable)&&Y.Base.mix(Y.DataTable,[Mutable])},"@VERSION@",{requires:["datatable-base"]})