Giter VIP home page Giter VIP logo

Comments (6)

amisadmin avatar amisadmin commented on June 2, 2024

I can not determine the specific reason, you can set a program breakpoint here to debug, see whether the code is running normally.

from fastapi-amis-admin.

MatsiukMykola avatar MatsiukMykola commented on June 2, 2024

i tried add some event logic, and this requires to set 'id' property for fields because that used to identify field. If not setup id when copypaste to editor online (to educate logic and properties) editor autogenerate id. So I little confuse id require or not?

    async def get_form_item(
        self, request: Request, modelfield: ModelField, action: CrudEnum
    ) -> Union[FormItem, SchemaNode, None]:
        item = await super().get_form_item(request, modelfield, action)

        if item.name == Trigger.event.key:  # noqa
            item.id = item.name

        if item.name == Trigger.target.key:  # noqa
            item.id = item.name  # noqa
            item.selectFirst = True  # noqa
            item.clearValueOnHidden = True  # noqa
            item.visibleOn = '${event!="STANDALONE"}'

            item.source = {
                "url": "TriggerAdmin/target_items/list?tet=${event}",
                "sendOn": 'event'
            }

        return item

maybe just autosetup id field at runtime? i newbe, maybe I'm not right, what you think about this ?

from fastapi-amis-admin.

amisadmin avatar amisadmin commented on June 2, 2024

Are you suggesting that the fastapi-amis-admin source code set an id for form items by default?

from fastapi-amis-admin.

MatsiukMykola avatar MatsiukMykola commented on June 2, 2024

because when insert to editor id autocreate, example:

"id": "u:57b6fb4bc910",

from fastapi-amis-admin.

amisadmin avatar amisadmin commented on June 2, 2024

The default id is not generated for two main reasons:

  1. I want the json data to be as concise as possible while the core functions are working properly.
  2. If id is set to name, it is not certain that conflicts will occur if the amis front-end has multiple form components.

from fastapi-amis-admin.

MatsiukMykola avatar MatsiukMykola commented on June 2, 2024

you're right, I think the demo requires a good extending
I will help with this when being possible, I like you library, but so many dark places)))

from fastapi-amis-admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.