So I created a large list and I can get it to display and all that, but I need it to be editable....
so far I've tried:
putting in an html input tag, which does display but I can't even get the cursor to show in the field when clicking on it.
putting in a TextField element from material-ui... same thing can't edit it, though it does show
I'm not sure if editable fields or even buttons are possible within react-virtualized. Would anybody know? Two images are below of what it looks like now, and what I need it to look and function like
Here is the react-virtualized code
<div style={{ width: "100%", height: "100vh" }}>
<AutoSizer>
{({ width, height }) => (
<List
width={width}
height={height}
rowHeight={cache.current.rowHeight}
deferredMeasurementCache={cache.current}
rowCount={downloadedData.length}
rowRenderer={({ key, index, style, parent }) => {
const translation = downloadedData[index];
return (
<Table
width={width}
height={height}
headerHeight={20}
rowHeight={90}
rowCount={downloadedData.length}
rowGetter={({ index }) => downloadedData[index]}
>
<Column
dataKey="key"
label="Key"
width={.5 * width}
style={{ backgroundColor: 'red', display: 'none ' }}
/>
<Column
dataKey="value"
label="Value"
width={.5 * width}
style={{ backgroundColor: 'blue' }}
/>
</Table>
);
}}
/>
)}
</AutoSizer>
</div>
What it looks like
What I need it to look like
Related
Hi i want to use https://github.com/react-native-picker/picker library horizontally. I also found some picker libraries that can be used horizontally but none of them works as stable as this native picker. I tried to give style transform rotate 90 deg but it caused the view below
And I couldnt reach text style to rotate it -90 deg.
I tried to download library and edit it but it's objective c and I don't know nothing about it. How can I do that any ideas?
My picker code
<Picker style={{
width: 100,
position: 'absolute',
right:50,
}}
itemStyle={{
fontSize: 20,
width: 100,
transform: [{ rotate: '90deg' }],
}}
selectedValue={Value}
onValueChange={(itemValue, itemIndex) => {
setValue(+itemValue);
}}
>
{Values.map(item => (
<Picker.Item
key={item.key}
label={item.value}
value={item.key}
></Picker.Item>
))}
</Picker>
I tried to edit the PickerItem.js in library like below but it didn't work
export default function PickerItem({
color,
label,
testID,
value,
enabled = true,
}: Props): React.Node {
return (
<Option
disabled={enabled === false ? true : undefined}
style={{color}}
testID={testID}
value={value}
label={label}>
<Text style={{transform: '-90deg', backgroundColor: 'red'}}>
{label}
</Text>
</Option>
);
}
and also I tried to add
label.transform = CGaffineTransformMakeRotation(M_PI / 2);
to RNCPicker.m
The default is [+] and [-].
and i want to increase this button size.
but i can't find the way in antd v.3.6.x...
Could not find a way to change it for more big size?
Thank you!!!
For antd version 3.6.x (for v3.1.x)
You can customize the css class .ant-table-row-expand-icon
.ant-table-row-expand-icon{
height: 25px;
width: 25px;
font-size: 30px;
}
Screenshot
For antd version 4.x
You can use expandIcon property to resize or change the icon, increase the fontSize to increase size of the icon
<Table
columns={columns}
expandable={{
expandedRowRender: (record) => (
<p style={{ margin: 0 }}>{record.description}</p>
),
rowExpandable: (record) => record.name !== 'Not Expandable',
expandIcon: ({ expanded, onExpand, record }) =>
expanded ? (
<MinusOutlined
style={{ fontSize: '20px' }}
onClick={(e) => onExpand(record, e)}
/>
) : (
<PlusOutlined
style={{ fontSize: '20px' }}
onClick={(e) => onExpand(record, e)}
/>
),
}}
dataSource={data}
/>
Screenshot
Antd Version < V4.x, you have to change the antd css directly.
Antd Version > V4.x. You can refer to the Ant Desing Doc codepen and style the expandIcon you want.
<Table
columns={columns}
dataSource={data}
expandable={{
expandedRowRender: record => (
<p style={{ margin: 0 }}>{record.description}</p>
),
expandIcon: ({ expanded, onExpand, record }) =>
expanded ? (
<MinusCircleTwoTone style={{ fontSize: "150%"}} onClick={e => onExpand(record, e)} />
) : (
<PlusCircleTwoTone style={{ fontSize: "150%"}} onClick={e => onExpand(record, e)} />
)
}}
codepen: https://codesandbox.io/s/fervent-bird-nuzpr?file=/index.js:1270-1684
I'm display a data table using prime react data table and I wanted to show tooltip or title like marked in below image, when mouse over doing on a cell.
I went through the Column component and i didn't find any relevant keyword to display tooltip or title on a cell, which is being used to show columns in data table.
Code:
<DataTable
value={this.state.products3}
editMode="row"
dataKey="id"
onRowEditInit={this.onRowEditInit}
onRowEditCancel={this.onRowEditCancel}
>
<Column field="code" header="Code" editor={(props) => this.codeEditor('products3', props)}></Column>
<Column rowEditor headerStyle={{ width: '7rem' }} bodyStyle={{ textAlign: 'center' }} title='Edit'></Column>
</DataTable>
Source: https://primefaces.org/primereact/showcase/#/datatable/edit
Your answer will be appreciated!
One way to fix this would be to use a custom body for your column. Like this:
<Column body={() => <Button icon="pi pi-pencil" className="p-button-rounded p-button-text" tooltip="Here's the tooltip!" />} headerStyle={{ width: '7rem' }} bodyStyle={{ textAlign: 'center' }} title="Edit"></Column>
Unfortunately I could not get this to work while also having the rowEditor property set, as in your example.
I wanted to scroll back up to the first element in the List when a user clicks pagination buttons.
So far I come across scrollToRow and scrollToIndex and both of them didn't work.
Here's my current code:
<AutoSizer disableWidth>
{({ height }) => (
<div>
<List
ref="list"
height={height}
rowCount={this.state.items.length}
rowHeight={115}
rowRenderer={this._rowRenderer}
width={1}
scrollToRow={0}
containerStyle={{
width: '100%',
maxWidth: '100%',
}}
style={{
width: '100%',
marginBottom: '10px',
}}
/>
</div>
)}
</AutoSizer>
After a little bit of thinking, I found out that there's no need to use react-virtualized package anymore. Since I refactored the list to make use of SSR pagination showing 24 items at a time. So, it was an overkill.
Anyway, I just reused the same _rowRenderer() function to map items into a list. To achieve the scrolling behavior I just added the styling prop of "overflow: scroll".
Thats all.
so i am trying to do a pie chart using recharts, but i want to do a custom legend like this:
so what i tried to do is create an ul and setting it next to it but the problem is its not responsive so thats why i'm thinking about custom legend. what i did so far:
i have no idea how to set up a margin that will make them equal or style them like this i really need help.
code:
<Row>
<Col lg="9">
<ResponsiveContainer width="100%" height={220}>
<PieChart data={testMeasurments.data}>
<Tooltip />
<Legend
height={170}
layout="vertical"
iconType="circle" align="right"
// iconType="circle" align="right" wrapperStyle={{
// // marginBottom: "10%",
// // marginRight: "30%",
// // marginLeft:"20%"
// // lineHeight: "-20px"
// }}
payload={
testMeasurments.map(
item => ({
id: item.name,
color:item.fill,
type: "circle",
value: `${item.name}` +" " + `${item.value}measurments` ,
})
)
}
>
</Legend>
{testMeasurments.map((s) =>
<Pie
dataKey="value"
isAnimationActive={false}
data={s.data}
outerRadius={100}
innerRadius={70}
fill="fill"
><Label value={value} position="center" />
</Pie>
)}
</PieChart>
</ResponsiveContainer>
</Col>
</Row>
old question but this might help someone. You can customise the legend using the content prop, you can check the doc
const renderLegend = (props) => {
const { payload } = props;
return (
<div style={{display: 'grid', gridTemplateColumns: 'max-content max-content', gap: '1em'}}>
{
payload.map((entry, index) => (
<div>entry.value</div><div>measurments</div>
))
}
</div>
);
}
<Legend content={renderLegend} />
You could use CSS to target each li item in the legend.
Recharts uses the class ".recharts-legend-item".
.recharts-legend-item {
margin-bottom: 10px;
}