turn off select...sometimes

turn off select...sometimes

montoyammontoyam Posts: 568Questions: 136Answers: 5

I have a dataTable where I need to enable select

        select: {
            style: 'multi'
        },

but, under certain conditions I need to turn off the ability to select. Is this possible?

I tired .select(false) but that didn't seem to work

        if (isNewRequest == 0) {
            if (selected.data().RequestHeader.ApprovedBy != null) {
                btnText = 'Close'; //no changes allowed
                RequestRoleSelectTable
                    .rows(function (idx, data, node) {
                        if (headerID == 0) {
                            return data.Users.UserID != null ? false : true;
                        } else {
                            return data.RequestDetails.RequestDetailID != null ? false : true;
                        }

                    })
                    .remove().draw();
                RequestRoleSelectTable.select(false);
            } else {
                btnText = 'Save'; //updating existing request
            }
        }

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 21,322Questions: 26Answers: 4,948
    Answer ✓

    I might be wrong but I don't think there is an API to toggle select on/off. However you could use select.selector() to set a fake classname to turn it off. The select.selector shows the default as td, th. You could turn it back on by using this selector.

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Yep, Kevin's right. I'd just knocked out this example before I realised he'd replied and said the same thing!

    Colin

  • montoyammontoyam Posts: 568Questions: 136Answers: 5

    you guys are awesome!!

    I can not talk enough about DataTables and the support you provide. I recommend it to others every chance I get.

Sign In or Register to comment.