My name is Alex, I am an Android developer, working at Etnetera Flow in Prague, Czech Republic.
Passionate about Kotlin and Compose ๐ป
Lazy layout to display columns and rows of data on the two directional plane.
License: Apache License 2.0
My name is Alex, I am an Android developer, working at Etnetera Flow in Prague, Czech Republic.
Passionate about Kotlin and Compose ๐ป
You have to register some form of items()
on creation otherwise the IntervalsList
crashes. While it makes sense on the face of it, probably should not make that a hard requirement.
When trying to add a LazyTable
the app crashes with:
java.lang.AbstractMethodError: abstract method "void androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider.Item(int, java.lang.Object, androidx.compose.runtime.Composer, int)"
at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt$SkippableItem$1.invoke(LazyLayoutItemContentFactory.kt:138)
at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt$SkippableItem$1.invoke(LazyLayoutItemContentFactory.kt:137)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
at androidx.compose.foundation.lazy.layout.LazySaveableStateHolder.SaveableStateProvider(LazySaveableStateHolder.kt:84)
at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt.SkippableItem-JVlU9Rs(LazyLayoutItemContentFactory.kt:137)
at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt.access$SkippableItem-JVlU9Rs(LazyLayoutItemContentFactory.kt:1)
Right now a LazyTable
will align its content to the its center, resulting in situations similar to this, when there are not items big enough to fill its size.
For example in the following screenshot the LazyTable
is using .fillMaxSize().background(Color.Green.copy(alpha = 0.2f))
and the single cell has a fixed width and height, smaller than the size of the table:
It would be nice to be able to set the content alignment, in a similar way to what the LazyList
offer:
/** The alignment to align items horizontally */
horizontalAlignment: Alignment.Horizontal? = null,
/** The alignment to align items vertically */
verticalAlignment: Alignment.Vertical? = null,
Alternatively, would it be possible to use the same alignment conventions as the LazyColumn
and LazyRow
, where the content is always aligned to the top start?
This way it will allow to use the .fillMaxSize()
, .fillMaxWidth()
and .fillMaxHeight()
modifiers without having to be sure that the items inside will actually fill the entire size of the table.
Hello,
I'm using LazyTable
for displaying value + unit data. However, I've run into a problem of data not fully displayed:
Is there a way to make the column width adjust automatically based on the content? This would help ensure that both longer unit texts and larger values are presented correctly.
Thanks a lot for your work on this library!
In my use case the table is full screen but as I've transparent navigation bars the table is displayed under the system bar. Would be nice if support for contentPadding: PaddingValues
could be added so it can scroll from edge to edge.
It would be nice to be able to use the official androidx.compose.material.pullrefresh
together with the LazyTable
.
Since LazyTable
is build on top of the androidx.compose.foundation.lazy.layout.LazyLayout
I just assumed that pullrefresh
would work out-of-the-box but that doesn't seem to be the case.
Here you can find a patch that adds it to the Android demo project.
Good day,
I am using your LazyTable in an app, and I am getting odd scroll behavior when near the bottom of the table. Either it will not reach the bottom, or it jumps back up slightly when I reach the bottom. I have attached a video attempting to show the issue. Note I have set the background of the LazyTable to gray so you can see where the bounds are.
Note I am using it from shared code, for both Android and iOS using Compose MP 1.6.1. Of course on Android it is using the main latest Google Compose which is 1.6.5 currently.
I have mostly worked around it by adding 3 extra rows at the bottom, for Android. On iOS, this scroll issue does not occur, so in that case I do not add any extra rows.
I know it may be some issue with Compose that your LazyTable is using, but I am putting it here in hopes you have seen it, can reproduce it and/or create a fix in the library.
Note that in the video, the last time slot visible should be 6:30 PM.
Thank you very much for the library and your assistance.
Good day,
I am using code very similar what is shown in here but I get a crash when I call the snapToCell (or animateToCell) method, like so:
kotlin.UninitializedPropertyAccessException: lateinit property positionProvider has not been initialized at eu.wewox.minabox.MinaBoxState.getPositionProvider(MinaBoxState.kt:53) at eu.wewox.lazytable.LazyTableState.getPositionProvider(LazyTableState.kt:53) at eu.wewox.lazytable.LazyTableState.getCellOffset-xEiAX8E(LazyTableState.kt:105) at eu.wewox.lazytable.LazyTableState.animateToCell(LazyTableState.kt:74) at eu.wewox.lazytable.LazyTableState.animateToCell$default(LazyTableState.kt:67) at com.salonbiz.library.views.FindTimesViewKt$FindTimesView$3$1.invokeSuspend(FindTimesView.kt:66)
I am unsure if I missing something, but it appears it should be creating the minabox.positionProvider, but it is not, hence the crash.
Any and all help appreciated. Thank you!
Using LazyTable 1.8.0 with Compose multi-platform 1.6.1.
hi , have a problem when i try to scroll up or down with LazyTable it get me touch action and make scroll right or left , how can i solve this issue
Hi,
Is there a way to pin a specific column, for example the last one?
Hi,
Thanks foe the great work of that library!
Is it possible to programmatically scroll the table in a direction? let's say Horizontally. where I need to scroll to a specific items or scroll to the very right of the table
UPDATE
Checked the code and managed to figure it out, I will keep it here in case someone needed it!
1.
val lazyTableState: LazyTableState = rememberLazyTableState()
LazyTable(
...
state = lazyTableState
)
LaunchedEffect(Unit) {
lazyTableState.snapToCell(column = 6, row = 0)
}
Hi, I am trying to display the pinned table and hide the pin configuration it is not visible in the screen but the table is coming in the middle of the screen
Column(
verticalArrangement = Arrangement.Top,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.fillMaxSize()
.padding(it)
) {
var settings by remember { mutableStateOf(Settings()) }
if (itemWiseReport.isEmpty()) {
Text(text = "No Data Found")
} else {
// Settings(
// settings = settings,
// onChange = { settings = it },
// )
LazyTable(
// pinConfiguration = pinConfiguration(settings),
// dimensions = dimensions(settings),
modifier = Modifier.fillMaxSize()
So I have this:
Column(
modifier = Modifier.verticalScroll(rememberScrollState())
) {
...
LazyTable()
}
And this cause the exception.
When I do:
Column(
modifier = Modifier.verticalScroll(rememberScrollState())
) {
...
LazyTable(
scrollDirection = LazyTableScrollDirection.HORIZONTAL
)
}
It's still cause exception.
How so solve it?
Curious how hard supporting wasm JS target would be? I am currently using this control in Compose MP KMP library, and it is working well. But I would also like to support a wasm target, and since this is not supported in this library, I cannot yet either.
Hello ๐
This library looks pretty slick, I'd love to use it in my project.
A common use case for tables is to display a footer, for example to show totals or averages:
student | quiz 1 | quiz 2 | final exam |
---|---|---|---|
Alice | 78% | 84% | 85% |
Bob | 87% | 87% | 85% |
Carol | 92% | 87% | 78% |
Dave | 88% | 83% | 82% |
------- | ------ | ------ | ---------- |
average | 86% | 85% | 82% |
Is it feasible to extend this project to allow a fixed footer row, similar to how a fixed header row is can be set?
Perhaps something like this:
public fun lazyTablePinConfiguration(
columns: Int = 0,
rows: Int = 0,
): LazyTablePinConfiguration { ... }
// could become
public fun lazyTablePinConfiguration(
columns: Int = 0,
rows: Int = 0,
// the count of pinned footer rows
endRows: Int = 0,
): LazyTablePinConfiguration { ... }
I did see #7, and the snippet provided there could be adapted to achieve this behavior. However showing a footer row is a very common use case for tables, and as such I believe it makes sense to add the capability to this library.
Hi, do you think it is possible to use LazyTable
together with the official androidx.paging:paging-compose
library?
We already use androidx.paging:paging-compose
for normal LazyColumn
and it would be great to be able to use it also with LazyTable
since some of the table we need to display can have thousands of rows and fetching all the data at once isn't feasible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.