Samuel M.
Samuel M.

Reputation: 91

ExtJS using MVVM

New to extjs, and I need to rewrite the code from MVM to MVVM . Part of the code below,

Ext.define('ExtMVC.model.Department', {
    extend: 'Ext.data.Model',
    fields: ['name'],
    proxy: {
        type: 'memory'
        ,reader: 'json'
        ,data: [
            {id: 1, name: 'Foo'}
            ,{id: 2, name: 'Bar'}
            ,{id: 30, name: 'Baz'}
        ]
    }
});

get full code and example and jsfiddle http://jsfiddle.net/rixo/vdazU/

Upvotes: 1

Views: 54

Answers (1)

polkattt
polkattt

Reputation: 333

You are on the right track, it just looks like you need to add a view model definition and then bind your view to the model. Take a look a the fiddle below. I grabbed your posted fiddle and made some adjustments with inline comments that should help you out.

https://fiddle.sencha.com/#view/editor&fiddle/23eb

Here is a quick reference:

http://docs.sencha.com/extjs/6.2.0/classic/Ext.app.ViewModel.html

Upvotes: 1

Related Questions