Add a blank row at the bottom of the table on clicking a button


Can we do something where the user can add a blank row at the bottom of the existing table when he clicks the button. Is it possible.


I also have this problem. Do you solve this problem?


I could able to do only for once, and when clicking the button next time, nothing has changed. I want to add rows according to the number of clicks that happen.

Like, if I click once, one row should get added irrespective of headings. And likewise, it should repeat the same for the next click.

Also I tried giving a loop (thought it would work), but the heading is getting added and at one click all the rows are adding up as per the given range and it is very annoying.


can you show me your code about adding row, thank you very much!

import dash
import pandas as pd
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
from dash.dependencies import Output, Input

app = dash.Dash(__name__)

fields = ['date', 'time']

df = pd.DataFrame()
for i in fields:
	df[i] = ''

app.layout = html.Div([
	html.Button(id='button', n_clicks=0, children='Add Fields'),
	html.Div(dt.DataTable(rows=[{}]), style={'display' : 'none'})

	Output('content', 'children'),
	[Input('button', 'n_clicks')]
def display_row(n_clicks):
	add_table = []
	add_index = []
	click = 0
	repeat = 1
	if n_clicks > 0:
					rows=[{fields[0] : '', fields[1] : ''}],
	return add_table
if __name__ == '__main__':

This just adds one row along with headings.


Thank you very much! It is of great use to me.