added row original

master
mahdi 3 years ago
parent c4ccca28d0
commit dd379cf355
  1. 7
      src/components/ReactTable4/BasicTable.js
  2. 174
      src/components/ReactTable4/MOCK_DATA.json

@ -275,7 +275,6 @@ import rightArrow from "./right-arrow.svg"; */}
</tr> </tr>
))} ))}
</thead> </thead>
<tbody <tbody
{...getTableBodyProps()} {...getTableBodyProps()}
className="divide-y divide-gray-200 bg-white" className="divide-y divide-gray-200 bg-white"
@ -304,7 +303,8 @@ import rightArrow from "./right-arrow.svg"; */}
{row.isExpanded ? ( {row.isExpanded ? (
<tr> <tr>
<td colSpan={headerGroups[0].headers.length}> <td colSpan={headerGroups[0].headers.length}>
{renderRowSubComponent({ row: row.values })} {renderRowSubComponent({ row: row.original })}
{/* {renderRowSubComponent({ row: row.values })} */}
</td> </td>
</tr> </tr>
) : null} ) : null}
@ -312,7 +312,6 @@ import rightArrow from "./right-arrow.svg"; */}
); );
})} })}
</tbody> </tbody>
<tfoot <tfoot
className={`bg-blue-900 ${rows.length > 10 ? "w-full" : "hidden"}`} className={`bg-blue-900 ${rows.length > 10 ? "w-full" : "hidden"}`}
> >
@ -402,7 +401,7 @@ import rightArrow from "./right-arrow.svg"; */}
function renderRowSubComponent({ row }) { function renderRowSubComponent({ row }) {
return ( return (
<div className="pl-2 pr-5 bg-blue-200"> <div className="pl-2 pr-5 bg-blue-200">
نام: {row.name} مبلغ: {row.history}
<br /> <br />
<button className="bg-blue-400">ویرایش</button> <button className="bg-blue-400">ویرایش</button>
</div> </div>

@ -1,182 +1,22 @@
[ [
{ {
"name": "مایکروویر سامسونگ مدل 1", "name": "mahdi",
"order-date": "1399/09/27", "order-date": "1399/09/27",
"order-price": 27, "order-price": 25,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 1,
"order-level": 1
},
{
"name": "مایکروویر سامسونگ مدل 2",
"order-date": "1399/09/25",
"order-price": 26,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 2,
"order-level": 2
},
{
"name": "مایکروویر سامسونگ مدل 3",
"order-date": "1399/09/22",
"order-price": 44,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 3,
"order-level": 3
},
{
"name": "لپ تاپ مک بوک اپل",
"order-date": "1410/09/27",
"order-price": 73,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 4,
"order-level": 4
},
{
"name": "تبلت اپل",
"order-date": "1375/09/25",
"order-price": 96,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 5,
"order-level": 5
},
{
"name": "مایکروویر سامسونگ مدل 1",
"order-date": "1399/09/27",
"order-price": 27,
"order-number": "09120023100", "order-number": "09120023100",
"user-job": "مهندس ساختمان", "user-job": "مهندس ساختمان",
"order-status": 1, "order-status": 1,
"order-level": 1 "order-level": 1,
}, "history": "مهدی"
{
"name": "مایکروویر سامسونگ مدل 2",
"order-date": "1399/09/25",
"order-price": 26,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 2,
"order-level": 2
},
{
"name": "مایکروویر سامسونگ مدل 3",
"order-date": "1399/09/22",
"order-price": 44,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 3,
"order-level": 3
},
{
"name": "لپ تاپ مک بوک اپل",
"order-date": "1410/09/27",
"order-price": 73,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 4,
"order-level": 4
},
{
"name": "تبلت اپل",
"order-date": "1375/09/25",
"order-price": 96,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 5,
"order-level": 5
}, },
{ {
"name": "مایکروویر سامسونگ مدل 1", "name": "tannaz",
"order-date": "1399/09/27", "order-date": "1399/09/27",
"order-price": 27, "order-price": 27,
"order-number": "09120023100", "order-number": "09120023100",
"user-job": "مهندس ساختمان", "user-job": "مهندس ساختمان",
"order-status": 1, "order-status": 1,
"order-level": 1 "order-level": 1,
}, "history": "tannaz"
{
"name": "مایکروویر سامسونگ مدل 2",
"order-date": "1399/09/25",
"order-price": 26,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 2,
"order-level": 2
},
{
"name": "مایکروویر سامسونگ مدل 3",
"order-date": "1399/09/22",
"order-price": 44,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 3,
"order-level": 3
},
{
"name": "لپ تاپ مک بوک اپل",
"order-date": "1410/09/27",
"order-price": 73,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 4,
"order-level": 4
},
{
"name": "تبلت اپل",
"order-date": "1375/09/25",
"order-price": 96,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 5,
"order-level": 5
},
{
"name": "مایکروویر سامسونگ مدل 1",
"order-date": "1399/09/27",
"order-price": 27,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 1,
"order-level": 1
},
{
"name": "مایکروویر سامسونگ مدل 2",
"order-date": "1399/09/25",
"order-price": 26,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 2,
"order-level": 2
},
{
"name": "مایکروویر سامسونگ مدل 3",
"order-date": "1399/09/22",
"order-price": 44,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 3,
"order-level": 3
},
{
"name": "لپ تاپ مک بوک اپل",
"order-date": "1410/09/27",
"order-price": 73,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 4,
"order-level": 4
},
{
"name": "تبلت اپل",
"order-date": "1375/09/25",
"order-price": 96,
"order-number": "09120023100",
"user-job": "مهندس ساختمان",
"order-status": 5,
"order-level": 5
} }
] ]

Loading…
Cancel
Save