Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1845
Making bool columns render as checkboxes
posted

I would like to render any columns which have bool values as checkboxes.  I've searched around and found several suggestions.  The suggestions I've tried don't work, so I figured I'd ask here before I wasted any more time.

I've tried setting the "renderCheckboxes: true", and setting the individual column dataType = "bool", and format = "checkbox", but the columns still display "true" or "false", not checkboxes.

Here's my javascript (rendered from an MVC helper):

$(function({
    $('#TransactionDetails_Grid').igGrid({
        dataSource'/TASCommissions/CommissionTransactions/_TransactionDetails_Grid',
        autoGenerateColumnsfalse,
        autoGenerateLayoutsfalse,
        responseDataKey'Records',
        generateCompactJSONResponsefalse,
        columns[{
            headerText'<span style=\'text-align: left; display:block;\'>Journal ID<span>',
            key'Journal_id',
            width'9%',
            hiddenfalse,
            formatternull,
            template'<span style=\'text-align: left; display:block;\'>${Journal_id}</span>'},
        {
            headerText'<span style=\'text-align: left; display:block;\'>Apply To<span>',
            key'Fk_journal_id',
            width'9%',
            hiddenfalse,
            formatternull,
            template'<span style=\'text-align: left; display:block;\'>${Fk_journal_id}</span>'},
        {
            headerText'<span style=\'text-align: left; display:block;\'>Contract ID<span>',
            key'Fk_cont_id',
            width'9%',
            hiddenfalse,
            formatternull,
            template'<span style=\'text-align: left; display:block;\'>${Fk_cont_id}</span>'},
        {
            headerText'<span style=\'text-align: left; display:block;\'>Transaction Type<span>',
            key'Fk_com_trans_type',
            width'16%',
            hiddenfalse,
            formatternull,
            template'<span style=\'text-align: left; display:block;\'>${Fk_com_trans_type}</span>'},
        {
            headerText'<span style=\'text-align: center; display:block;\'>Date<span>',
            key'Journal_date',
            width'13%',
            hiddenfalse,
            formatterOrange.toDateString,
            template'<span style=\'text-align: right; display:block;\'>${Journal_date}</span>'},
        {
            headerText'<span style=\'text-align: center; display:block;\'>Amount<span>',
            key'Journal_amount',
            width'9%',
            hiddenfalse,
            formatterOrange.toCurrencyString2,
            template'<span style=\'text-align: right; display:block;\'>${Journal_amount}</span>'},
        {
            headerText'<span style=\'text-align: left; display:block;\'>Created By<span>',
            key'Journal_created_by',
            width'9%',
            hiddenfalse,
            formatternull,
            template'<span style=\'text-align: left; display:block;\'>${Journal_created_by}</span>'},
        {
            headerText'<span style=\'text-align: center; display:block;\'>Chargeback Flag<span>',
            key'Journal_chargeback_flag',
            width'13%',
            hiddenfalse,
            dataType'bool',
            format'checkbox'},
        {
            headerText'<span style=\'text-align: center; display:block;\'>Reserve<span>',
            key'Journal_reserve_flag',
            width'7%',
            hiddenfalse,
            dataType'bool',
            format'checkbox'},
        {
            headerText'<span style=\'text-align: left; display:block;\'>Status<span>',
            key'Journal_status',
            width'9%',
            hiddenfalse,
            formatternull,
            template'<span style=\'text-align: left; display:block;\'>${Journal_status}</span>'},
        {
            headerText'<span style=\'text-align: left; display:block;\'>Fk_cpmt_id<span>',
            key'Fk_cpmt_id',
            width'0',
            hiddentrue,
            formatternull,
            template'<span style=\'text-align: left; display:block;\'>${Fk_cpmt_id}</span>'}],
        features[{
            sortUrlKey'sort',
            sortUrlKeyAscValue'asc',
            sortUrlKeyDescValue'desc',
            name'Sorting',
            mode'single'},
        {
            name'Selection',
            mode'row',
            multipleSelectionfalse},
        {
            filterExprUrlKey'filter',
            filterLogicUrlKey'filterLogic',
            name'Filtering'}],
        jQueryTemplatingfalse,
        autoAdjustHeighttrue,
        width'100%',
        renderCheckboxestrue,
        initialDataBindDepth0,
        localSchemaTransformfalse
    });
});

I suspect that "autoGenerateLayouts = false" may be overriding my checkbox settings, but it seems to be set to false even if the property in my MVC helper is set to true, so I can't test it. Same with "autoGenerateColumns".  Perhaps there is yet another property which causes autoGenerateLayouts and autoGenerateColumns to be automagically set to false?  Just speculating, maybe it's something else all together.