webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
795 stars 272 forks source link

How onchange column? #156

Open Chatchaia opened 7 years ago

Chatchaia commented 7 years ago
var columns = [];
columns.push({ name: "id" });
columns.push({ name: "name_en",       label:"Name EN", datatype: "string", editable: true});
columns.push({ name: "name_cn",       label:"Name CN", datatype: "string", editable: true});
columns.push({ name: "gender" ,       label:"Gender" , datatype: "string", editable: true});
columns.push({ name: "date_of_birth", label:"Date of birth", datatype: "date", editable: true, onchange: function(){ alert(); } });
columns.push({ name: "age",           label:"Age",           datatype: "integer", editable: true ,"bar":true});
columns.push({ name: "passport",      label:"Passport",      datatype: "string", editable: true});
columns.push({ name: "tel",           label:"Tel",      datatype: "string", editable: true});
columns.push({ name: "action",        label:"<center>Action</center>",   datatype: "html", editable: false});
// a small example of how you can manipulate the object in javascript
columns[3].values = { "male":"MALE", "female":"FEMALE"};

editableGrid = new EditableGrid("guest_list");
editableGrid.load({"metadata": columns, "data": []});
editableGrid.renderGrid("guest", "testgrid");
MSIH commented 7 years ago

What feature or functionality are you asking about? From your example, you want to run some javascript when when the column changes. But what change to the column? if you mean edit the cell value, then see demo example modelChange.