1 // ========================================================================== 2 // Project: SproutCore - JavaScript Application Framework 3 // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 // Portions ©2008-2011 Apple, Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 /** 9 A delegate for table resize operations. 10 */ 11 SC.TableDelegate = { 12 /** 13 Walk like a duck. 14 */ 15 isTableDelegate: YES, 16 17 /** 18 Called just before a table resizes a column to a proposed width. You 19 can use this method to constrain the allowed width. The default 20 implementation uses the minWidth and maxWidth of the column object. 21 */ 22 tableShouldResizeColumnTo: function(table, column, proposedWidth) { 23 var min = column.get('minWidth') || 0, 24 max = column.get('maxWidth') || proposedWidth; 25 26 proposedWidth = Math.max(min, proposedWidth); 27 proposedWidth = Math.min(max, proposedWidth); 28 29 return proposedWidth; 30 }, 31 32 tableShouldResizeWidthTo: function(table, proposedWidth) { 33 var min = table.get('minWidth') || 0, 34 max = table.get('maxWidth') || proposedWidth; 35 36 proposedWidth = Math.max(min, proposedWidth); 37 proposedWidth = Math.min(max, proposedWidth); 38 39 return proposedWidth; 40 } 41 }; 42