I am working on a list view, where i have a choice column named TrackingStatus
. Now for this choice column i defined the default value to be In Progress
from the site columns settings.
But i have noticed that inside the Quick edit grid the default value for the TrackingStatus
column will not be rendered (unlike inside the built-in create and edit forms).. so i tried to implement the default values using JS Link as follow:
I upload the following script inside my site collection:
(function () {
alert("1");
var overrideContext= {};
overrideContext.Templates = overrideContext.Templates || {};
overrideContext.Templates.Fields = {
"TrackingStatus": {
"View": function (ctx) {if(ctx.CurrentItem.your_column == "")
return "In Progress";
}
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext);
})();
Then I edit my list view WebPart and I provide the following to reference the above JSlink under the WebPart Miscellaneous section.:
~sitecollection/Resources/defaultvalues.js
But the JS Link is not having any effect in respect to applying default values for my column, although when I checked the page source I can see that the defaultvalues.js
is being loaded and i got the alert(1) which I intentionally added inside the JS Link.
How can I define default values for my choices columns inside the Quick Edit grid?