JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › General Discussions › Kanban not seeing userId › Reply To: Kanban not seeing userId
May 24, 2021 at 8:06 pm
#101839
Anonymous
Inactive
The problem is not assigning the user. Essentially I took the “Editable” example and I created a PHP script to generate the data. In the Editable example the window.getKanbanData() is setting the assignment of the user to the task and the Kanban shows that. When I do that same thing sending it via json remotely, it is not setting it properly.
So if I set my javascript as…
async function fetchData() { let response = await fetch('/she_test/test2.php'); console.log(response.status); if (response.status === 200) { let kbData = await response.json(); window.Smart('#kanban', class { get properties() { return { addNewButton: true, collapsible: true, dataSource: kbData.tasks, editable: true, taskActions: true, taskDue: true, taskProgress: true, userList: true, users: kbData.users, columns: [ { label: 'To do', dataField: 'toDo' }, { label: 'In progress', dataField: 'inProgress' }, { label: 'Testing', dataField: 'testing' }, { label: 'Done', dataField: 'done', addNewButton: false } ] }; } }); return kbData } } fetchData(); and it is calling a the following php script...<?php $out = array('tasks'=>array(),'users'=>array()); $out['tasks'][] = array( 'id' => 0, 'status' => 'done', 'text' => 'Task 1', 'tags' => getTags(0), 'progress' => 100, 'userId' => 2 ); $out['tasks'][] = array( 'id' => 1, 'status' => 'done', 'text' => 'Task 2', 'tags' => getTags(1), 'priority' => 'high', 'progress' => 100, 'userId' => 3 ); $out['tasks'][] = array( 'id' => 2, 'status' => 'done', 'text' => 'Task 4', 'tags' => getTags(2) .', '. getTags(3), 'priority' => 'high', 'progress' => 100, 'userId' => 2 ); $out['tasks'][] = array( 'id' => 3, 'status' => 'done', 'text' => 'Task 5', 'tags' => getTags(3), 'userId' => 1 ); $out['tasks'][] = array( 'id' => 4, 'status' => 'done', 'text' => 'Task 6', 'tags' => getTags(1) .', '. getTags(3), 'progress' => 100, 'userId' => 0 ); $out['tasks'][] = array( 'id' => 5, 'status' => 'testing', 'text' => 'Task 7', 'tags' => getTags(2), 'progress' => 90, 'userId' => 3 ); $out['tasks'][] = array( 'id' => 7, 'status' => 'Task 8', 'tags' => getTags(1) .', '. getTags(3), 'progress' => 100, 'userId' => 3 ); $out['tasks'][] = array( 'id' => 6, 'status' => 'testing', 'text' => 'Task 9', 'tags' => getTags(4), 'color' => '#9966CC', 'userId' => 3 ); $out['tasks'][] = array( 'id' => 8, 'status' => 'inProgress', 'text' => 'Task 21', 'tags' => getTags(4) .', '. getTags(1), 'progress' => 25, 'userId' => 0 ); $out['tasks'][] = array( 'id' => 9, 'status' => 'inProgress', 'text' => 'Task 22', 'tags' => getTags(2), 'priority' => 'high', 'progress' => 85, 'color' => 'red', 'userId' => 1 ); $out['tasks'][] = array( 'id' => 10, 'status' => 'inProgress', 'text' => 'Task 23', 'tags' => getTags(5), 'userId' => 2 ); $out['tasks'][] = array( 'id' => 11, 'status' => 'toDo', 'text' => 'Task 24', 'tags' => getTags(5), 'priority' => 'high', 'progress' => 0 ); $out['tasks'][] = array( 'id' => 12, 'status' => 'toDo', 'text' => 'Task 25', 'tags' => getTags(2) ); $out['tasks'][] = array( 'id' => 13, 'status' => 'toDo', 'text' => 'Task 26', 'tags' => getTags(2) .', '. getTags(5) .', '. getTags(1), 'priority' => 'low', 'userId' => 4 ); $out['tasks'][] = array( 'id' => 14, 'status' => 'toDo', 'text' => 'Task 27', 'userId' => 1 ); $out['tasks'][] = array( 'id' => 15, 'status' => 'toDo', 'text' => 'Task 28', 'tags' => getTags(1) ); $out['users'][] = array('id'=> 0, 'name'=> 'Andrew', 'image'=> '/she_test/images/people/andrew.png'); $out['users'][] = array('id'=> 1, 'name'=> 'Anne', 'image'=> '/she_test/images/people/anne.png'); $out['users'][] = array('id'=> 2, 'name'=> 'Janet', 'image'=> '/she_test/images/people/janet.png'); $out['users'][] = array('id'=> 3, 'name'=> 'John', 'image'=> '/she_test/images/people/john.png'); $out['users'][] = array('id'=> 4, 'name'=> 'Laura', 'image'=> '/she_test/images/people/laura.png'); echo json_encode($out); exit(); function getTags($tag=0){ $tags = array( 0 => 'initial', 1 => 'data', 2=>'visual', 3=>'property', 4=>'scrolling', 5=>'method'); return $tags[$tag]; } It should set the assignment of the tasks be setting the userId in the json data. It is not doing that. I have tried many different ways, just nothing seems to work.