FeaturesTable (Custom FieldInfos Input) – Esri Community
I am currently trying to customise my features table so that the fieldsInfo input (Annoucements) would not have any special characters. I do not know how to implement this into the features table.
Sorry I do not have a lot of experience with the API, please advise 🙂 thank you.
var regex = new RegExp(/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/);
function regexTest(value){
if(regex.test(value)){
console.log("Has special characters")
}
else{
return value;
}
}
var featureTable = new FeatureTable({
featureLayer: featureLayer,
editable: true,
syncSelection: true,
dateOptions: {
datePattern: 'dd/MM/y',
timeEnabled: true,
timePattern: 'HH:mm:ss',
},
hiddenFields: ["objectid", "objectid_1"],
fieldInfos: [{
name: 'announcement', //Should not have any special characters
alias: 'Announcement'
},
{
name: 'created_user',
alias: 'Created By',
editable: false
},
{
name: 'created_date',
alias: 'Created Date',
editable: false
},
],
gridOptions: {
noDataMessage: "No Data",
allowSelectAll: true,
cellNavigation: true,
selectionMode: "extended",
pagination: true,
allowTextSelection: true,
pageSizeOptions: [10, 25, 50, 100, 200],
columnHider: true,
columnResizer: true,
},
menuFunctions: [{
label: "Add New Record",
callback: addNewRecord
},
{
label: "Delete Record(s)",
callback: deleteRecord
},
]
}, 'tableNode');
Read more here: Source link
