Angular ui-grid inserts spaces between capital letters By default, Angular ui-grid inserts spaces between capital letters, so that "NSA ID" becomes "N S A I D" which is unreadable. This can be corrected by setting your own displayName on each column, but there may be times you do not want to do that. So instead, you can edit the ui-grid.js to fix the problematic behavior. Solution: Within the function readableColumnName, replace this line: .replace(/(\w+?(?=[A-Z]))/g, '$1 '); With this line: .replace(/([a-z]+?(?=[A-Z]))/g, '$1 ').replace(/([A-Z]+?(?=[A-Z][a-z]))/g, '$1 '); This will replace "MyNSAId" with "My NSA Id" and "FreeTheIDMakers" with "Free The ID Makers". In addition, you may want to comment out the code that replaces an all-capsed word with an init-caps version, since that changes "NSA" to "Nsa" which may not be intended. // Replace a completely all-capsed word with a first-letter-capitalized version //.replace(/^[A-Z]+$/, function (match) { // return angular.lowercase(angular.uppercase(match.charAt(0)) + match.slice(1)); //}) Be sure to also update your minified version, if any.
Created By: amos 2/21/2017 10:49:55 AM Updated: 2/21/2017 10:58:42 AM
|
|