import * as React from 'react';
import './App.css';
import JqxSortable, { ISortableProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxsortable';
const InnerItems = (props: any) => {
return
|
{props.firstName} {props.lastName} |
| {props.title} |
};
const firstNames = ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert', 'Laura', 'Anne'];
const lastNames = ['Davolio', 'Fuller', 'Leverling', 'Peacock', 'Buchanan', 'Suyama', 'King', 'Callahan', 'Dodsworth'];
const titles = ['Sales Representative', 'Vice President, Sales', 'Sales Representative', 'Sales Representative', 'Sales Manager', 'Sales Representative', 'Sales Representative', 'Inside Sales Coordinator', 'Sales Representative'];
const firstNamesLength = firstNames.length;
const isValidFirstHalf = (index: number) => index < Math.floor(firstNamesLength / 2);
const isValidSecondHalf = (index: number) => index >= Math.floor(firstNamesLength / 2);
const SortableComponent = (props: any) => {
const validation = (whichHalf: string, index: number): any => {
if (whichHalf === "A") {
return isValidFirstHalf(index);
} else {
return isValidSecondHalf(index);
}
};
return
Team {props.whichHalf}
{firstNames.map((firstName, i): any => {
if (validation(props.whichHalf, i)) {
const imgurl = 'https://www.jqwidgets.com/react/images/' + firstNames[i].toLowerCase() + '.png';
return ;
}
})}
;
};
class App extends React.PureComponent<{}, ISortableProps> {
constructor(props: {}) {
super(props);
this.state = {
connectWith: ".sortable",
opacity: 0.5
}
}
public render() {
return (
);
}
}
export default App;