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

Group with complex field name doesn't work if load records as data #5493

Closed
chuckn0rris opened this issue Oct 28, 2022 · 4 comments
Closed
Labels
bug Something isn't working forum Issues from forum OEM OEM customer wontfix This will not be worked on

Comments

@chuckn0rris
Copy link

Forum post

Code to reproduce below. Open an app and see that grouping is incorrect.
Try to set objects as data, not Diner instances - all works as expected.

class FoodItem extends Model {
    static fields = [{
        name : 'foodType'
    }]
}
class Diner extends Model {
    static fields = [{
        name   : 'foodItem',
        type   : 'model',
        convert: function(data) {
                return new FoodItem(data);
            }

    }]
}

let diner1 = new Diner ({
            name     : 'Anim',
            age      : 20,
            city     : 'SF',
            color    : 'red',
            food     : 'Burger',
            foodItem : {
                foodType : 'Junk Food'
            }});
let diner2 = new Diner ({
            name     : 'Siam',
            age      : 21,
            city     : 'LA',
            color    : 'blue',
            food     : 'Apple',
            foodItem : {
                foodType : 'Healthy Food'
            }});

let grid = new Grid({
    appendTo : 'container',

features : {
    group : 'foodItem.foodType'
},

columns : [
    {
        text   : 'Name',
        field  : 'name',
        flex   : 2,
        editor : {
            type     : 'textfield',
            required : true
        }
    }, {
        text  : 'Age',
        field : 'age',
        width : 100,
        type  : 'number'
    }, {
        text  : 'City',
        field : 'city',
        flex  : 1
    }, {
        text  : 'Food',
        field : 'food',
        flex  : 1,
    }, {
        text     : 'Color (not sortable)',
        field    : 'color',
        flex     : 1,
        sortable : false,
        renderer({ cellElement, value }) {
            // renderer that sets text color = text
            cellElement.style.color = value;
            return value;
        }
    }
],
store : {
    modelClass : Diner,

    data: [diner1, diner2]

}
});
@chuckn0rris chuckn0rris added bug Something isn't working forum Issues from forum OEM OEM customer labels Oct 28, 2022
@henriquewerlang
Copy link

Any news?

@matsbryntse matsbryntse self-assigned this Mar 7, 2023
@matsbryntse
Copy link
Member

Thanks for the ping! We'll try to fix this soon, sorry for the delay.

@henriquewerlang
Copy link

Thanks!

@matsbryntse matsbryntse added the ready for review Issue is fixed, the pull request is being reviewed label Mar 7, 2023
@isglass isglass added wontfix This will not be worked on and removed ready for review Issue is fixed, the pull request is being reviewed labels Mar 8, 2023
@isglass
Copy link
Contributor

isglass commented Mar 8, 2023

@henriquewerlang Seems to have been a misunderstanding among my colleagues, we do not support field names with dots in them. See the forum thread for the approach we do support.

And on a side-note, the ModelDataField (type: 'model') isn't public so might be risky to use that in your application.

Will close this ticket

@isglass isglass closed this as completed Mar 8, 2023
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 wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants