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
430
igGrid Column should not be movable
posted

Hi All,

I am new to Infragistics in MVC.I need to set first column of the grid should not be movable from first position.I tried "ColumnMoving" property by setting allowMoving and enable property to false.I was not able to move the column by dragging but using 'Moving options' property I can able to move second column to first position and I can able to move other columns to first position.Please let me know your suggestions.

Please find the code given below.

$.ig.loader({

scriptPath: "@Url.Content("~/Content/Scripts")",

cssPath: "@Url.Content("~/Content/css")",

resources: 'igGrid.*',

ready: function () {

$.getJSON("@Url.Content("~/ProviderInquiry/GetAll")", JSON.stringify(dataResponse), function (data) {

var headerTextValues = ["ID", "Suffix", "NPI", "Title", "Address Line1", "Status"];

$('#employeeGrid').igGrid({

expandCollapseAnimations: true,

animationDuration: 1000,

expandTooltip: "Expand to View Details",

collapseTooltip: "Hide details",

height: "35%",

width: "100%",

dataSource: data,

responseDataKey: "Records",

dataSourceType: "json",

autoGenerateLayouts: false,

autoGenerateColumns: false,

rowEditDialogContainment: "owner",

showReadonlyEditors: false,

columns: [

{

headerText: headerTextValues[0], key: "ProviderID", width: 100,

template: "<a href='@Url.Content("~/Provider/Provider?ProviderInternalNum=${ProviderInternalNum}")' target='_blank'>${ProviderID}</a>"

},

{ headerText: headerTextValues[1], key: "ProviderSuffix", width: 70 },

{ headerText: headerTextValues[2], key: "NPI", width: 100 },

{ headerText: headerTextValues[3], key: "ProviderTitle", width: 155 },

{ headerText: headerTextValues[4], key: "ProviderAddress1", width: 165 },

{ headerText: headerTextValues[5], key: "ProviderStatus" }

],

features: [

{

name: "ColumnMoving",

columnSettings: [

{

columnKey: "ProviderID",

allowMoving: false,

Enable: false

}

]

},

)}

}

Thanks,

Pradeep

Parents
No Data
Reply
  • 29417
    Offline posted

    Hello Pradeep, 

    Thank you for posting in our forum. 

    You can prevent a specific column to be moved via the allowMoving option via the column settings:

    However that will only prevent the specific column to be moved, while all other columns can be rearranged in any order.

    If you’d like to prevent any other columns from taking the first position I suggest you use the columnMoving event and cancel it in all cases when the  args.targetIndex is 0. This will ensure that moving any other column to index 0 will be canceled.

     Example: 

    $(document).delegate(".selector", "iggridcolumnmovingcolumnmoving", function (evt, args) {

    if(args.targetIndex === 0){

                    return false;

    }

        });

     

    Let me know if you have any questions.

     

    Best Regards,

    Maya Kirova

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

     

Children