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

provided callback for rowMoved #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Options can be

{
"movableColumns": true,
"movableRows": true,
"resizableColumns": true,
"selectable": 5,
"responsiveLayout": "collapse",
Expand All @@ -32,13 +33,14 @@ Options can be

Columns can be

[ {title:"Name", field:"name", editor:"input"},
{title:"Task Progress", field:"progress", align:"left", formatter:"progress", editor:true},
{title:"Gender", field:"gender", width:95, editor:"select", editorParams:{values:["male", "female"]}},
{title:"Rating", field:"rating", formatter:"star", align:"center", width:100, editor:true},
{title:"Color", field:"col", width:130, editor:"input"},
{title:"Date Of Birth", field:"dob", width:130, sorter:"date", align:"center"},
{title:"Driver", field:"car", width:90, align:"center", formatter:"tickCross", sorter:"boolean", editor:true}
[
{title:"Name", field:"name", editor:"input"},
{title:"Task Progress", field:"progress", align:"left", formatter:"progress", editor:true},
{title:"Gender", field:"gender", width:95, editor:"select", editorParams:{values:["male", "female"]}},
{title:"Rating", field:"rating", formatter:"star", align:"center", width:100, editor:true},
{title:"Color", field:"col", width:130, editor:"input"},
{title:"Date Of Birth", field:"dob", width:130, sorter:"date", align:"center"},
{title:"Driver", field:"car", width:90, align:"center", formatter:"tickCross", sorter:"boolean", editor:true}
]

Pass input data in msg.payload. Note that options and columns can also be passed in via msg.
Expand All @@ -54,4 +56,5 @@ CallBacks handled are :

If the cell has editor = true, a message is sent with "callback : cellEdited"
If the cell has editor = false, a message is sent with "callback : cellClick"
If rows are movable, a message is sent with "callback : rowMoved"

7 changes: 7 additions & 0 deletions etable.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@ module.exports = function (RED) {
opts.cellEdited = function(cell) {
$scope.send({topic:cell.getField(),callback:"cellEdited",payload:cell.getData(),options:opts});
};
}

if( opts.movableRows){
opts.rowMoved = function(row) {
$scope.send({callback:"rowMoved",payload:{row: row.getData(), position: row.getPosition()},options:opts});
};
}

var table = new Tabulator(basediv, opts);
};
$scope.init = function (config) {
Expand Down