jQuery UI Widgets Forums Grid Toggle grid as editable based on condition

This topic contains 3 replies, has 2 voices, and was last updated by  Hristo 7 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • sjkcwatson
    Participant

    Is there a way to set the true/false of the grid editable property based on a condition (ie the variable IsAdmin=’Y’)

     $("#jpxgridUsers").jqxGrid({
            width: '95%',
            source: gridDataAdapter,
            selectionmode: 'multiplerowsextended',
            sortable: true,
            pageable: true,
            autoheight: true,
            columnsresize: true,
            pagesize: 20,
            pagermode: 'default',
            showfilterrow: true,
            filterable: true,
            altrows: true,
            enabletooltips: false,
            editable: true,
            columns: [
                { text: 'Employee ID', dataField: 'EmployeeID', cellsalign: 'left', align: 'left', editable: false, cellclassname: cellclass },
                { text: 'First Name', dataField: 'FirstName', cellsalign: 'left', align: 'left', cellclassname: cellclass },
                { text: 'Last Name', dataField: 'LastName', cellsalign: 'left', align: 'left', cellclassname: cellclass },
                { text: 'Login', dataField: 'Login', cellsalign: 'left', align: 'left', cellclassname: cellclass },
                { text: 'Admin', hidden: 'true', dataField: 'IsAdmin', cellsalign: 'left', align: 'left', cellclassname: cellclass },
                { text: 'Active', hidden: 'true', dataField: 'IsActive', cellsalign: 'left', align: 'left', cellclassname: cellclass },
                { text: 'Admin', dataField: 'IsAdminNumeric', width: '5%', cellsalign: 'center', align: 'center', columntype: 'checkbox' }, //, cellclassname: cellclass, cellbeginedit: cellbeginedit 
                { text: 'Active', dataField: 'IsActiveNumeric', width: '5%', cellsalign: 'center', align: 'center', columntype: 'checkbox' } //, cellclassname: cellclass, cellbeginedit: cellbeginedit
    
            ]
        });

    sjkcwatson
    Participant

    I got it by setting a variable to true or false and setting editable: vIsEditable


    sjkcwatson
    Participant

    I forgot to set async: false on my json that was setting the variable so the grid code was loading before the variable was set.

    Toggle grid as editable based on condition #91393

    Hristo
    Participant

    Hello sjkcwatson,

    You could use the approach as in this example.
    If you mean to change dynamically the state of the Grid – to switch between editable: true/false. You could use $('#jqxgrid').jqxGrid({ editable: false});
    Hope this helps.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    • This reply was modified 7 years, 4 months ago by  Hristo.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.