KivyMD
KivyMD copied to clipboard
KivyMD MDDataTable header not appearing if only one column data was specified
Description of the Bug
I was trying to have a MDDatatable appear on a click of button within which it will have a single column or sometimes more than one column. But I see the header was disappearing if there are only one column specified. column headers were appearing if we have more than one column. There is no crash or something.
Expectation : I am expecting the column header to come even if I prefer to have a single column.
Actual : Header disappearing in MDDataTable if we have only single header
Already discussed about this in kivy support group forum with . Attaching the mail convesations link here. https://groups.google.com/g/kivy-users/c/d9OvMyId0lc/m/SrOvUedIAwAJ?utm_medium=email&utm_source=footer
Code and Logs
from kivy.metrics import dp from kivymd.app import MDApp from kivymd.uix.datatables import MDDataTable class Example(MDApp): def build(self): self.data_tables = MDDataTable( use_pagination=True, check=True, column_data=[ ("No.", dp(30)) ], row_data=[ ( "1" ) ] )
return self.data_tables
Example().run()
Screenshots
Please find the short video link of this issue here : https://youtu.be/Q8SHqSorHfQ
Versions
- OS: Windows
- Python: 3.9.13
- Kivy: 2.2.0
- KivyMD: 1.1.1
https://kivymd.readthedocs.io/en/latest/components/datatables/
Hey @HeaTTheatR , Is it not a bug or is it already taken care of or that's the expected functionality kivymd offers ?
Please first read the documentation on using the MDDataTable
widget.
Hi @HeaTTheatR , I have red the documentation. I don't find anything mentioned related to this issue. Can you be please be kind enough to explicitly state your point here ?. It will be helpful for kivy users for future reference.
@Aravind0007 I don't see any problem. Your code example contradicts the documentation
Hi @HeaTTheatR , I have just returned the widget to illustrate the header was missing in the widget itself if there is only one column data was specified. No matter how we use it, it was still missing in any layouts. I am a very new kivy user. Can you please tell me how we can use a MDDataTable with single column only then ?
@Aravind0007 You haven't attached any sample code...
Hi @HeaTTheatR , I have mentioned the sample code in above issue as well. Specifying here as well :
from kivy.metrics import dp from kivymd.app import MDApp from kivymd.uix.datatables import MDDataTable class Example(MDApp): def build(self): self.data_tables = MDDataTable( use_pagination=True, check=True, column_data=[ ("No.", dp(30)) ], row_data=[ ( "1" ) ] )
return self.data_tables
Example().run()
@Aravind0007 Your code example contradicts the documentation
Hi @HeaTTheatR, Sorry I am not getting it. How my code contradicts the documentation? How can we achieve Data table with single column without header being disappearing?
https://github.com/kivymd/KivyMD/blob/master/kivymd/uix/datatables/datatables.py#L340