Skip to content

button click edit and delete to get data from loop is not working #513

Closed Answered by bobwatcherx
bobwatcherx asked this question in Q&A
Discussion options

You must be logged in to vote

yes it is working fine . thanks

code

from nicegui import ui
import sqlite3

# membuat koneksi database dan cursor
conn = sqlite3.connect('db/mainan.db',check_same_thread=False)
cursor = conn.cursor()


name = ui.input(label="username").classes("w-full")
age = ui.input(label="age").classes("w-full")


def addnewdata():
	try:
		cursor.execute('''INSERT INTO users (name, age) VALUES (?, ?)''', (name.value, age.value))
		conn.commit()
		ui.notify(f"succes add data {name.value}")
		name.value = ""
		age.value = ""
		list_alldata.clear()
		get_all_data()
	except Exception as e:
		print(e)

ui.button("add data",
	on_click=addnewdata
	).classes("bg-blue-200")
	
list_alldata = ui.column()



def e…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bobwatcherx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants