change entry value


Topic: change entry value

HadiNasser asked 5 years ago

Hi

i am using MdbDataTable with react js and am trying to create a custom show entry dropdown and taking the value from it and assign it to a state value, and assigning it like this

<MDBDataTable<br> searching={false}<br> displayEntries={false}<br> borderless<br> noBottomColumns<br> small<br> entriesOptions={[5, 10, 15, 20, 25]}<br> entries={entries}<br> info={false}<br> data={transferList}<br> />

but somehow its not working and still show 5 entries (initial value) can someone help, or is it even possible to do that?

<div class="entries" style={{ display: 'inline' }}>
              <select onChange={event => handleEntries(event.target.value)}>
                <option value="5">5</option>
                <option value="10">10</option>
                <option value="15">15</option>
                <option value="20">20</option>
                <option value="25">25</option>
              </select>
            </div>

this is how i get the entries value:

handleEntries = async (entery) => { await this.setState({ entries: parseInt(entery) }); }


Piotr Glejzer staff commented 5 years ago

what data do you have in variable entries? Just 5? Do you have more logic to show?


HadiNasser commented 5 years ago

i edited the question, i get the entries value from the select and then re-render the component with the new entry value,but nothing happens


Piotr Glejzer staff commented 5 years ago

there is not possible to do it like that. You can only put a data like number to show entries with select. This is not possible to put your own select.


HadiNasser commented 5 years ago

the only reason am using my own select is that i want the entries dropdown to be below the table not above, is there a way to do that with the built in select? thank you for your time


Piotr Glejzer staff commented 5 years ago

It's not, sorry. I will start to re-write datatable in the next week so I will look into that.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.25.6
  • Device: Laptop
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No
Tags