lowcoder icon indicating copy to clipboard operation
lowcoder copied to clipboard

[Feat]: Expose index value on ListView and GridView

Open mdpung opened this issue 1 year ago • 0 comments
trafficstars

Is your feature request related to a problem? Please describe. Currently, only components internal to a ListView/GridView have access to the index (defualt i). There are use cases in which components outside could benefit from the index it is using.

Describe the solution you'd like Expose a index data property on the ListView component. Then it could be used in the context of: listView.index.

Describe alternatives you've considered All of the alternatives I could think of have to do with creating a component inside the list view and somehow extracting that information to a temporary state, but since the list view instantiates a component for each listview index, I cannot think of a trivial way to trigger such an update.

Additional context Looking at the code, the properties that get exposed are defined here.

Adding the variable to be exposed would look something like this:

  depsConfig({
    name: "index",
    desc: trans("listView.itemIndexNameDesc"),
    depKeys: ["itemIndexValue"],
    func: (input) => input.itemIndexValue
  })

Other code would of course needed to be needed to add the itemIndexValue variable, but this is just the crux of it.

There are no instructions on how to build the application locally so without spending too much time, I am unable to create a PR for the feature.

mdpung avatar Jan 31 '24 23:01 mdpung