Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Function - update header and template #8

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ var mytable = $('#edittable').editTable({
There are of course many methods which can be used on the created table. Let's see...

```js
mytable.loadData(dataArray); // Fill the table with js data
mytable.loadJsonData(jsonData); // Fill the table with JSON data
mytable.getData(); // Get a js array of the table data
mytable.getJsonData(); // Get JSON from the table data
mytable.reset(); // Reset the table to the initial set of data
mytable.isValidated() // Check if the table pass validation set with validate_field
mytable.loadData(dataArray); // Fill the table with js data
mytable.loadJsonData(jsonData); // Fill the table with JSON data
mytable.getData(); // Get a js array of the table data
mytable.getJsonData(); // Get JSON from the table data
mytable.reset(); // Reset the table to the initial set of data
mytable.isValidated(); // Check if the table pass validation set with validate_field
mytable.update(header,template); // Update header:[<string>] and template: [<string>] ,
// Do mytable.reset(); after update.
```

To define a <strong>custom field type</strong> object:

```js
Expand Down
15 changes: 13 additions & 2 deletions jquery.edittable.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@

checkButtons();
}


// Update settings - header , template
function updateSettings(header = null, template = null) {
solid-droid marked this conversation as resolved.
Show resolved Hide resolved
if (template != null) s.row_template = template;
if (header != null) s.headerCols = header;
}

// Export data
function exportData() {
var row = 0, data = [], value;
Expand Down Expand Up @@ -302,7 +308,12 @@
},
isValidated: function () {
return is_validated;
}
},
//update header and template
update: function (header, template) {
updateSettings(header, template);
solid-droid marked this conversation as resolved.
Show resolved Hide resolved
},

};
};

Expand Down