We have a County table as follows -
State Table is as follows -
Country table is as follows
We want to create the dialog template for editing. Here is our code for calling the template -
Following is the function for the dialog template -
But when the edit screen shows up it does not select the State Province and Country from the dropdown. Can someone help us with this?
Hi Ameet,
Sorry for the delay response. We have reviewed your query about issue dialog template when performing editing in the grid. We have achieved your requirement by including dialog template in the grid and setting dropdown for a field. We have attached the code snippet and sample for your reference.
|
function DialogFormTemplate(props) { React.useEffect(() => { let states = val; }, []); const [token, setToken] = React.useState(null); const countryFromApi = new DataManager({ url: `https://courtconnectapi.azurewebsites.net/odata/Country?$select=Id,CountryName`, adaptor: new ODataV4Adaptor(), crossDomain: true, headers: [{ Authorization: `Bearer ${token}` }], }); const [val, setval] = React.useState(extend({}, {}, props, true)); let data = val; return ( <div> <div className="form-row"></div> <div className="form-row"> <div className="form-group col-md-6"> <DropDownListComponent id="ShipCountry" value={data.shipCountry} dataSource={countryFromApi} fields={{ text: 'CountryName', value: 'CountryName' }} placeholder="Select Country" popHeight="300px" floatLabelType="Always" ></DropDownListComponent> </div> </div> </div> ); }
|
Sample: https://stackblitz.com/edit/react-ibc3cf?file=index.js,data.js
Please let us know if you need any further assistance.
Regards,
Dineshnarasimman