gantt-task-react icon indicating copy to clipboard operation
gantt-task-react copied to clipboard

Is there an example of TaskListHeader、TaskListTable?

Open sjzpengyuyan opened this issue 3 years ago • 3 comments

image

sjzpengyuyan avatar Jan 18 '22 10:01 sjzpengyuyan

Hi @sjzpengyuyan , Please check the https://github.com/MaTeMaTuK/gantt-task-react/blob/main/src/components/task-list/task-list-header.tsx and https://github.com/MaTeMaTuK/gantt-task-react/blob/main/src/components/task-list/task-list-table.tsx

MaTeMaTuK avatar Jan 19 '22 14:01 MaTeMaTuK

Hi @MaTeMaTuK

Could you please provide a JS example of TaskListHeader/TaskListTable? I mean how to use them in JS project. As I'm using react JS but not familar TS...

Thanks

jasonusdid avatar Feb 23 '22 06:02 jasonusdid

Hi,

I have created an example of TaskListTable example with JS, but the expenderClick function not work, could you please help to take a look? Thanks a lot.

table.js: // begin import React from "react";

export const TaskListTableDefault = ({ rowHeight, rowWidth, tasks, fontFamily, fontSize, onExpanderClick, }) => { return ( <div style={{ fontFamily: fontFamily, fontSize: fontSize, }} > {tasks.map(t => { let expanderSymbol = ""; if (t.hideChildren === false) { expanderSymbol = "▼"; } else if (t.hideChildren === true) { expanderSymbol = "▶"; }

    return (
      <div
        style={{ height: rowHeight }}
        key={`${t.id}row`}
      >
        <div
          style={{
            minWidth: rowWidth,
            maxWidth: rowWidth,
          }}
          title={t.name}
        >
          <div>
            <div
              onClick={() => onExpanderClick(t)}
            >
              {expanderSymbol}
            </div>
            <div>{t.name}</div>
          </div>
        </div>
        <div
          style={{
            minWidth: rowWidth,
            maxWidth: rowWidth,
          }}
        >
          aaa
        </div>
        <div
          style={{
            minWidth: rowWidth,
            maxWidth: rowWidth,
          }}
        >
          bbb
        </div>
      </div>
    );
  })}
</div>

); };

In App.js: TaskListTable={() => <TaskListTableDefault tasks={tasks} onExpanderClick={handleTableExpanderClick}/>}

jasonusdid avatar Feb 24 '22 04:02 jasonusdid