Closed edge-blade closed 7 years ago
The following filter appears to work, but I may consider changing the columns parameter to accept an object instead taking { columnName:String, displayText: String }
convertColumnToTitle(str) {
return str.replace(/[_-]/g, ' ')
.replace(/([A-Z][a-z])/g,
function(match) {
if(match == '_' || match == '-')
return ` `;
return ` ${match}`;
})
.replace(/\w\S*/g,
function(txt) {
return txt[0].toUpperCase() + txt.slice(1).toLowerCase();
}
);
}
Based on other table libraries it makes sense to allow custom header text so users have the option to set table headers to blank or different than the data property.
Currently the table-header renders with each property capitalized. The system should be slightly improved to create multiple words and create spaces on typical variable breaks.
e.g. CreateDate, create_date, create-date should all be converted to Create Date.