Skip to content
Merged
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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.0.46
v0.0.47
2 changes: 1 addition & 1 deletion info.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "LaswitchTech",
"email": "support@laswitchtech.com",
"date": "2025-10-22",
"version": "v0.0.46",
"version": "v0.0.47",
"tags": "tasks, management, workflowhub",
"description": "Tasks Plugin for the LaswitchTech Core Framework.",
"repository": "https://github.com/LaswitchTech/core-plugin-tasks",
Expand Down
36 changes: 24 additions & 12 deletions library.js
Original file line number Diff line number Diff line change
Expand Up @@ -1325,22 +1325,34 @@ builder.add('widgets','tasks', class extends builder.ComponentClass {
// Set Self
const self = this;

// Check if records are provided
if(records !== null && Object.entries(records).length > 0){

// Loop through the records
// Create a loader function
const loader = function(records){
for(const [key, record] of Object.entries(records)){
this.add(record);
self.add(record);
}
return this;
self.datatable().rows().every(function(rowIdx, tableLoop, rowLoop){
if(typeof records[this.data()['id']] === 'undefined'){
self.datatable().row(rowIdx).remove();
}
});
return self;
};

// Check if records are provided
if(records !== null && Object.entries(records).length > 0){
return loader(records);
}

// Retrieve Followups
API.endpoint('/tasks/fetchAll').data({conditions: this._properties.conditions}).execute(function(response){
for(const [key, record] of Object.entries(response.records)){
self.add(record);
}
});
// Retrieve Records
if(Array.isArray(this._properties.conditions)){
API.endpoint('/tasks/fetchAll').data({conditions: self._properties.conditions}).execute(function(response){
return loader(response.records);
});
} else {
API.endpoint('/tasks/fetchAll').execute(function(response){
return loader(response.records);
});
}

return this;
}
Expand Down