Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panel fields items not being populated from record config #8328

Open
ghulamghousdev opened this issue Jan 23, 2024 · 1 comment
Open

Panel fields items not being populated from record config #8328

ghulamghousdev opened this issue Jan 23, 2024 · 1 comment
Labels
bug Something isn't working forum Issues from forum OEM OEM customer

Comments

@ghulamghousdev
Copy link
Member

Forum post

Hello, Team!

I have noticed that the record config works for Container (meaning it populates field values based on record), but not for Panel. Is this expected? Panel extends Container and I guess it should work the same.

Sample code:

const record = new Model({
	firstName: 'John',
	lastName: 'Smith',
});

const items = {
	firstName: {
		type: 'textfield',
		name: 'firstName',
		label: 'First Name',
	},
	lastName: {
		type: 'textfield',
		name: 'lastName',
		label: 'Last Name',
	},
};

new Panel({
	appendTo: document.body,
	record,
	items,
});

new Container({
	appendTo: document.body,
	record,
	items,
});

@ghulamghousdev ghulamghousdev added bug Something isn't working forum Issues from forum OEM OEM customer labels Jan 23, 2024
@ghulamghousdev ghulamghousdev self-assigned this Jan 23, 2024
@ghulamghousdev ghulamghousdev removed their assignment Mar 22, 2024
@scebotari66
Copy link

The root cause is in the childItems getter. The Container references this.items in the getter, whereas the Panel references this._items, which is not yet initialized when updateRecord is called.

Not sure if this needs fixing. It will work for the Panel if you declare the items config before the record, like so:

new Panel({
  appendTo: document.body,
  items,
  record,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum OEM OEM customer
Projects
None yet
Development

No branches or pull requests

2 participants