var _table = null; function PermissionsTable() { } PermissionsTable.prototype = { 'initialize' : function(sLookupName, sEntityName, aPermissions) { bindMethods(this); this.aPermissions = aPermissions; this.oLookup = getJSONLookupWidget(sLookupName); this.oLookup.sAction += '&' + queryString({'permissions':map(function(a){return a['id'];}, aPermissions)}); this.oLookup.addTrigger('add', this.addRow); this.oLookup.addTrigger('remove', this.removeRow); this.oLookup.addTrigger('postInitialize', this.enableForm); this.aRows = {}; this.dContainer = $('permissions_table_container'); this.dTHead = THEAD(null, TR(null, TH({'width':'40%'}, sEntityName), map(function(aPerm) { return TH({'class':'centered'}, aPerm['name']); }, aPermissions))); this.dTBody = TBODY(null); this.dTable = TABLE({'class':'kt_collection'}, this.dTHead, this.dTBody); this.dSubmit = $('submitButtons'); hideElement(this.dSubmit); replaceChildNodes(this.dContainer, this.dTable); }, '_getARow' : function(oRow) { var aKeys = keys(this.aRows); var found = false; for(var i=0; i