我一直在遵循使用React的固定数据表的教程。
http://facebook.github.io/fixed-data-table/
虽然教程在应用程序中直接使用少量JSON而不是外部源,但一切看起来都很酷。我希望从github gist中导入我的
我到目前为止的代码如下。
我知道我并没有完全正确地把它拉进去,所以任何帮助都会受到赞赏。
感谢
const rows = 'https://gist.githubusercontent.com/theuser/fwqgfwrgqw/raw/qwfefwqefrgthgtwg81bba6df90f46eaa5e7681c13/programmes.json';
ReactDOM.render(
<Table
height={rows.length * 30}
width={1150}
rowsCount={rows.length}
rowHeight={30}
headerHeight={30}
rowGetter={function(rowIndex) {return rows[rowIndex]; }}>
<Column dataKey="id" width={50} label="Id" />
<Column dataKey="name" width={200} label="Name" />
<Column dataKey="shortDescription" width={200} label="Description" />
<Column dataKey="active" width={400} label="Active Status" />
</Table>,
document.getElementById('example')
);
下面的是JSON的一个例子
{
"id": 1938,
"slug": "drivers-rebooted",
"name": "test one",
"shortName": "test one",
"shortDescription": "Another look at some of the nation's oldest drivers.",
"longDescription": "Another look at some of the nation's oldest drivers, including 102-year-old test yser who is determined to stay on the road - despite being barely able to hear.",
"active": true,
"type": "generic",
"defaultExpiry": 30,
"availableEpisodes": 2,
"images": [
{
"id": 456025,
"filename": "456025-100-year-old-drivers-rebooted.jpg",
"masterFilepath": "456\/",
"_filepath": "http]"
}
],
},