0
votes
  • I have a users grid, on double click of users grid I am showing update user form in a window modal popup.
  • on dblClick of users grid I am adding user-detail-window to mainView.
  • user-detail-window contains a user-detail form, which contains checkbox field called active
  • If user_abc is not active, then for the first time after opening update form for user_abc, its showing unchecked active field (this is correct behavior, user_abc is already deactived)
  • If you open any other user record (which is active) and then again open user_abc (this is already deactivated), its shows active filed checked (instead of showing unchecked)

i) I have a checkbox field in user update form i.e. my UserDetail view

Ext.define('TestCMS.view.UserDetail', {
extend: 'Ext.form.Panel',
alias: 'widget.user-detail',
itemId: 'user-detail',

items: [
    {
        xtype: 'combobox',
        name: 'locale',
        fieldLabel: 'Taal',
        store: 'i18n.Language',
        displayField: 'iso639',
        valueField: 'iso639',
        autoLoad: true,
        forceSelection: true,
        editable: false,
        triggerAction: 'all',
        bind: '{currentText.locale}',
    },
    {
        xtype: 'checkboxfield',      //all fields in this form
        name: 'active',              //are showing proper data,
        fieldLabel: 'Actief',        //except this checkbox
        bind: '{currentText.active}'
    },
    {
        xtype: 'ckeditor',
        fieldLabel: 'description',
        itemId: 'ckeditor-body',
        name: 'text',
        bind: '{currentText.text}',
        msgTarget: 'under',

        CKConfig: {
            extraPlugins: wordcount,notification',
        }
    }
});

ii) Following is MainView

    Ext.define('TestCMS.view.UserMain', {
    extend: 'Ext.container.Container',
    alias: 'widget.user-main',
    itemId: 'user-main',
    layout: 'border',
    defaults: {
        split: true,
        border: 0
    },
    viewModel: {
        type: 'user-vm',
    },
    items: [
        {
            xtype: 'user-grid',
            reference: 'user-grid',
            region: 'west',
            width: 350,
            title: 'users',
            multiSelect: false
        }
   });

iii) Following is detailWindowView

Ext.define('TestCMS.view.UserDetailWindow', {
    extend: 'Ext.window.Window',
    alias: 'widget.UserDetailWindow',
    itemId: 'user-detail-window',
    controller: 'user-detail',
    requires: [
        'TestCMS.controller.UserDetail',
    ],

    layout: 'fit',
    minHeight: 632,
    minWidth: 1088,
    closable: true,
    modal: true,
    closeAction: 'destroy',
    maximizable: true,

    bind: {
        hidden: '{userDetailPanelDisabled}',
    },
    items: [
        {
            xtype: 'user-detail',
        }
    ],
    renderTo: Ext.getBody(), //This line causes the bug
});
  • I have added this line (i.e. renderTo: Ext.getBody()) to show Popup window on entire screen. Without this line popup window is showing within a container only.
  • After adding only this line in above code, checkbox functionality related error occurred, otherwise it was working fine.

iv) Following is user gridview dblClick handler

onItemDblClick: function (view, record, item, index, e, eOpts) {
    var userDetailWindow = Ext.widget('UserDetailWindow');
    var mainView = view.up('#user-main');
    viewModel = mainView.getViewModel();

    mainView.add(userDetailWindow);
    userDetailWindow.down('#user-detail').loadRecord(record);
    contentWindow.show();
    contentWindow.setTitle('user: ' + viewModel.data.userName);
},
1
Can you give some fiddle instead of such lengthy stuff ? - Tejas

1 Answers

0
votes

Found solution after trying many different things

1) Removed Items[] from detailWindowView

items: [
    {
        xtype: 'user-detail',
    }
],

2) Added user-detail runtime to user-detail-window within onItemDblClick

mainView.add(userDetailWindow);
//added this line and problem solved
contentWindow.add(Ext.widget('user-detail'));
contentWindow.show();
contentWindow.setTitle('user: ' + viewModel.data.userName);