tabalinas / jsgrid

Lightweight Grid jQuery Plugin
http://js-grid.com
MIT License
1.53k stars 353 forks source link

Column should have a default value and should be non editable in the insert template #1389

Open rowter opened 3 years ago

rowter commented 3 years ago

Hello,

In the grid, I want to have a default value for one column. I followed the link below and it worked. https://github.com/tabalinas/jsgrid/issues/471#issuecomment-253190090

Issue is , users are able to edit the default value in the Insert template.

name: "CID", type: "text", width: 50, title: "CID", readonly: true, editing: false, insertTemplate: function () { var input = this.__proto__.insertTemplate.call(this); input.val('SCHHS'); return input;

Users should not be able to modify the default value in the insert template.

Thanks in advance

nandakumar-a commented 3 years ago

try to add attribute or property for input tag by disabled or readonly

name: "CID", 
type: "text", 
width: 50, 
title: "CID", 
readonly: true,
editing: false,
 insertTemplate: function ()
 { 
var input = this.__proto__.insertTemplate.call(this); 
input.val('SCHHS');
input.prop("disabled",true);
 return input;
}