Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: set checklist in checkbox when window reopen

  1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    32

    Default Answered: set checklist in checkbox when window reopen

    hi i have a modal window that have grid panel form like this
    ask.JPG
    then, i have check in "c" row. how can i keep that check position when the modal window reopened.
    this is my code:
    Code:
    var check = new Ext.selection.CheckboxModel({
            checkOnly : true,
        });  
    
    
    var grid1 = Ext.create('Ext.grid.Panel', {
        title: 'Group Fields',
        id:'gridPanel',
        selModel: check,
        store: Ext.data.StoreManager.lookup('tes'),
        columns: [{
            text: 'Field',
            dataIndex: 'field',
            //align: 'center',
            flex: 1 
        }],
        viewConfig: {
           markDirty: false
         },
        height: 200,
        width: 400
    });
    pls help. thx.

  2. You can use search store's functions like find() or findBy()

  3. #2
    Sencha User Jad's Avatar
    Join Date
    Feb 2012
    Location
    annecy france / geneve suisse
    Posts
    149
    Answers
    12

  4. #3
    Sencha User
    Join Date
    Mar 2013
    Posts
    32

    Default

    hi jad. thx for your reply but i have try read and try some methods in there. but i still fail. what method i should use for my case.?

  5. #4
    Sencha User Jad's Avatar
    Join Date
    Feb 2012
    Location
    annecy france / geneve suisse
    Posts
    149
    Answers
    12

    Default

    Ext.create('Ext.grid.Panel', { renderTo: Ext.getBody(), store: Ext.create('Ext.data.Store', { fields: [{name: 'name'}], data: [ {name: 'jad'}, {name: 'toto'}, {name: 'selected'} ] }), title: 'grid', columns: [{ dataIndex: 'name', text: 'name', flex: 1 }], selModel: Ext.create('Ext.selection.CheckboxModel'), listeners: { afterrender: function (grid) { grid.getSelectionModel().select(2) } } });

  6. #5
    Sencha User
    Join Date
    Mar 2013
    Posts
    32

    Default

    hi jad. i've try your code but it still doesn't work. when the window reopened, the checkbox was unchecked.

  7. #6
    Sencha User Jad's Avatar
    Join Date
    Feb 2012
    Location
    annecy france / geneve suisse
    Posts
    149
    Answers
    12

    Default

    can you show me the code of your window ?

  8. #7
    Sencha User
    Join Date
    Mar 2013
    Posts
    32

    Default

    i'm sorry i don't know how to import file from local to jsfiddle to make a modal window. because i use 2 file to make it.
    maybe this is more simple case. how to set default check in ext.selection.checkbox when loaded.?

    u can see my code in here.

    http://jsfiddle.net/y0uzha/f73kx37e/1/

    how if i want to check the row of gridpanel depends from value of the textfield .?

  9. #8
    Sencha User Jad's Avatar
    Join Date
    Feb 2012
    Location
    annecy france / geneve suisse
    Posts
    149
    Answers
    12

    Default

    var datafields = Ext.create('Ext.data.Store', {
    storeId:'tes',
    fields: ['field'],
    data : [
    { "field":"a"},
    { "field":"b"}
    ]
    });

    var check = new Ext.selection.CheckboxModel({
    checkOnly : true,
    listeners: {
    change: function(checkbox, value) {

    }
    }
    });


    Ext.create('Ext.form.Panel', {
    renderTo: "example-grid",
    bodyStyle: 'padding: 5px 5px 0 5px;',
    items: [
    {
    xtype: 'textfield',
    fieldLabel: 'Group Fields ',
    value:'a',
    readOnly: true,
    inputId: 'group'
    }]
    });


    var grid1 = Ext.create('Ext.grid.Panel', {
    title: 'Group Fields',
    id:'gridPanel',
    selModel: check,
    store: Ext.data.StoreManager.lookup('tes'),
    columns: [{
    text: 'Field',
    dataIndex: 'field',
    flex: 1
    }],
    viewConfig: {
    markDirty: false
    },
    listeners: {
    viewready: function() {
    check.doSelect(grid1.store.data.items[0]);
    },
    scope: this
    },

    height: 200,
    width: 200
    });


    Ext.create('Ext.tab.Panel', {
    width: 200,
    height: 200,
    renderTo: "example-grid",
    items: [grid1]
    });

  10. #9
    Sencha User
    Join Date
    Mar 2013
    Posts
    32

    Default

    thx it works. but how if i want check it depends the value of textfield. for example, if the value of textfield is A,B. ??

  11. #10
    Sencha User Jad's Avatar
    Join Date
    Feb 2012
    Location
    annecy france / geneve suisse
    Posts
    149
    Answers
    12

    Default

    You can use search store's functions like find() or findBy()

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •