• checkbox xtype rendering#

  • onepack Reply #1, 1 year, 1 month ago

    Reply
    I have an module CMP page with items that can be set on active or inactive by clicking the checkbox. This can be done while creating or in the overview page.

    The checkbox renders fine in the create modular window but in the overview it only renders as the value 1 or 0.
    When I update an item it renders as a checkbox and when I'm finished updating it renders as the value true...

    This is the code used to display the checkbox.
     {
                header: _('bcontrol.active')
                ,dataIndex: 'active'
                ,sortable: false
                ,width: 30
                ,editor: { xtype: 'checkbox' }
            }
    


    What to do to show the checkbox in the correct way?
    Where can I find examples or documentation on this?

    Thank you so much for the reply!!


  • splittingred Reply #2, 1 year, 1 month ago

    Reply
    You'll need to use: Ext.ux.grid.CheckColumn

    Check out manager/assets/modext/widgets/element/modx.grid.template.tv.js for a demo (the Template -> TVs tab).


  • onepack Reply #3, 1 year, 1 month ago

    Reply
    Wow.. that's quick! Thanks for the great support Splittingred!


  • onepack Reply #4, 1 year, 1 month ago

    Reply
    This totally rocks :-) It works like a charm.


  • onepack Reply #5, 1 year, 1 month ago

    Reply
    One last thing, it seems that autosave doesn't work for the checkbox when it's displayed in the grid.
    The autosave only works for the other fields but not the checkbox. Is there a way to accomplish this.. I have looked for an example in modx where I see this functionality but I never see it with checkboxes. Is that correct or am I missing something?


        var tt = new Ext.ux.grid.CheckColumn({
            header: _('bcontrol.active')
            ,dataIndex: 'active'
            ,width: 30
            ,sortable: false
        });
        
        Ext.applyIf(config,{
            id: 'bcontrol-grid-brands'
            ,url: Bcontrol.config.connector_url
            ,baseParams: { action: 'mgr/brand/getList' }
            ,save_action: 'mgr/brand/updateFromGrid'
            ,fields: ['id','brandid','name','active','extra','menu']
            ,paging: true
            ,autosave: true
    


  • onepack Reply #6, 1 year, 1 month ago

    Reply
    In modx.grid.plugin.event.js I found:

        var ec = new Ext.ux.grid.CheckColumn({
            header: _('enabled')
            ,dataIndex: 'enabled'
            ,editable: true
            ,width: 80
            ,sortable: false
        });


    I tried applying "editable: false" on the checkbox so the users can only edit it when the update the whole "table row" and not from the overview since I'm unable to autosave the checkbox in the grid.
    But I don't see any effect using "editable: false" I can still select the object and change it in the grid. (no autosave afterwards).


  • onepack Reply #7, 1 year, 1 month ago

    Reply
    Ok, I found some useful information in this topic about the autosave questions: http://modxcms.com/forums/index.php?topic=61410.0


  • Lucas Reply #8, 3 months, 4 weeks ago

    Reply
    I'm trying to implement the same thing now. The example above is used with a local store and (I guess as you found out) it's not used with autosave.

    Did you end up figuring this one out?