CCategoryEditTree.jsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import * as React from "react";
  2. import {TreeViewComponent} from "@syncfusion/ej2-react-navigations";
  3. import {connect} from "react-redux";
  4. import {actionFullRootCats} from "../../../actions/ActionCategory";
  5. export class CCategoryEditTree extends React.Component {
  6. constructor(category, onGetCategory) {
  7. super(...arguments);
  8. this.category = category
  9. this.productTeam = [
  10. {
  11. id: 1, name: 'ASP.NET MVC Team',
  12. child: [
  13. { id: 2, pid: 1, name: 'Smith'},
  14. { id: 3, pid: 1, name: 'Johnson'},
  15. { id: 4, pid: 1, name: 'Anderson' },
  16. ]
  17. },
  18. {
  19. id: 5, name: 'Windows Team',
  20. child: [
  21. { id: 6, pid: 5, name: 'Clark' },
  22. { id: 7, pid: 5, name: 'Wright' },
  23. { id: 8, pid: 5, name: 'Lopez' },
  24. ]
  25. },
  26. {
  27. id: 9, name: 'Web Team',
  28. child: [
  29. { id: 11, pid: 9, name: 'Joshua' },
  30. { id: 12, pid: 9, name: 'Matthew' },
  31. { id: 13, pid: 9, name: 'David' },
  32. ]
  33. },
  34. {
  35. id: 14, name: 'Build Team',
  36. child: [
  37. { id: 15, pid: 14, name: 'Ryan' },
  38. { id: 16, pid: 14, name: 'Justin' },
  39. { id: 17, pid: 14, name: 'Robert' },
  40. ]
  41. },
  42. {
  43. id: 18, name: 'WPF Team',
  44. child: [
  45. { id: 19, pid: 18, name: 'Brown' },
  46. { id: 20, pid: 18, name: 'Johnson' },
  47. { id: 21, pid: 18, name: 'Miller' },
  48. ]
  49. }
  50. ];
  51. this.fields = {
  52. dataSource: this.productTeam,
  53. id: 'id',
  54. parentID: 'pid',
  55. text: 'name',
  56. hasChildren: 'hasChild',
  57. selected: 'isSelected'
  58. };
  59. this.allowDragAndDrop = true;
  60. this.allowMultiSelection = true;
  61. }
  62. render() {
  63. return (
  64. <TreeViewComponent fields={this.fields} allowMultiSelection={this.allowMultiSelection} allowDragAndDrop={this.allowDragAndDrop}/>
  65. );
  66. }
  67. }
  68. export const CCCategoryEditTree = connect(state => ({category: state.category}))(CCategoryEditTree)