heratech
17 Apr 2012, 1:43 AM
Hi,
I am using Extjs 4.1 rc3 and Ext Direct and Cakephp.
Example list of users: User belongsto Group, HasOne profile
When cakephp returns data it returns it in a format like:
[0] => Array
(
[User] => Array
(
[US_KEY] => 366
[US_NAME] => "John Smith"
)
[Profile] => Array
(
[PR_KEY] => 290
[PR_COUNTRY] => "UK"
[PR_TIMEZONE] => "GMT"
)
[Group] => Array
(
[GR_KEY] => 413
[GR_NAME] => "Administrators"
}
}
[1] => Array
{
[User]...continued
I keep having to flatten these arrays for grids and forms then unflatten them when sending forms/grid filters back (because cakephp needs fields for filtering in the format Model.fieldname - e.g User.US_NAME).
I know extjs has field mappings and the record option in json reader. For the grid filtering i created an override that instead of using the column dataIndex for fieldname it uses a new attribute (postFieldName for example).
I am just wondering what is the best way to handle this.
Thanks
I am using Extjs 4.1 rc3 and Ext Direct and Cakephp.
Example list of users: User belongsto Group, HasOne profile
When cakephp returns data it returns it in a format like:
[0] => Array
(
[User] => Array
(
[US_KEY] => 366
[US_NAME] => "John Smith"
)
[Profile] => Array
(
[PR_KEY] => 290
[PR_COUNTRY] => "UK"
[PR_TIMEZONE] => "GMT"
)
[Group] => Array
(
[GR_KEY] => 413
[GR_NAME] => "Administrators"
}
}
[1] => Array
{
[User]...continued
I keep having to flatten these arrays for grids and forms then unflatten them when sending forms/grid filters back (because cakephp needs fields for filtering in the format Model.fieldname - e.g User.US_NAME).
I know extjs has field mappings and the record option in json reader. For the grid filtering i created an override that instead of using the column dataIndex for fieldname it uses a new attribute (postFieldName for example).
I am just wondering what is the best way to handle this.
Thanks