Skip to content

Latest commit

 

History

History
116 lines (105 loc) · 3.08 KB

submasters.md

File metadata and controls

116 lines (105 loc) · 3.08 KB

SubMaster

Avails facility to list/create/update/delete records for submaster

import { Provider, SubMaster } from '@knovator/masters-admin`;

function App() {
    return (
        <Provider
            ...
        >
            <SubMaster />
        </Provider>
    )
}

(back to top)

SubMaster.Table

  • Avails facility to show Table component for Master explicitly.
  • Available props are mentioned in data-formats
    <SubMaster>
        <SubMaster.Table />
    </SubMaster>

(back to top)

SubMaster.Pagination

  • Avails facility to show Pagination component for Master explicitly.
    <SubMaster>
        <SubMaster.Table />
        <SubMaster.Pagination />
    </SubMaster>

(back to top)

SubMaster.Search

  • Avails facility to show Search component for Master explicitly.
  • Search records in master, as user starts typing
    <SubMaster>
        <SubMaster.Search />
    </SubMaster.Search>

(back to top)

SubMaster.AddButton

  • Avails facility to open Form, when clicked
    <SubMaster>
        <SubMaster.AddButton />
    </SubMaster.Search>

(back to top)

SubMaster.FormWrapper

  • Avails facility to access form parameters, to use when explicitForm is true for Master
    <Master
        explicitForm={true}
    >
        <SubMaster.FormWrapper>
            {({ formState, onClose, open }) => (
                ...
            )}
        </SubMaster.FormWrapper>
    </SubMaster>

(back to top)

SubMaster.FormActions

  • Avails facility to show FormActions, to be used inside FormWrapper along with Form. Required to provide formRef.
    const formRef = React.createRef();
    
    // return
    <Master
        explicitForm={true}
    >
        <SubMaster.FormWrapper>
            {({ formState, onClose, open }) => (
                <>
                    <SubMaster.Form ref={formRef} />
                    <SubMaster.FormActions formRef={formRef} />
                </>
            )}
        </SubMaster.FormWrapper>
    </SubMaster>

(back to top)

SubMaster.Form

  • Avails facility to show Form, to be used inside FormWrapper along with FormActions. Required to provide ref.
    const formRef = React.createRef();
    
    // return
    <Master
        explicitForm={true}
    >
        <SubMaster.FormWrapper>
            {({ formState, onClose, open }) => (
                <>
                    <SubMaster.Form ref={formRef} />
                    <SubMaster.FormActions formRef={formRef} />
                </>
            )}
        </SubMaster.FormWrapper>
    </SubMaster>

(back to top)