jQWidgets Forums

jQuery UI Widgets Forums Grid change editable dynamically

This topic contains 8 replies, has 2 voices, and was last updated by  Programmerswe 9 years, 8 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • change editable dynamically #75861

    Programmerswe
    Participant

    Hi!

    So ive got a signed in user, which i can access with document.getElementById.
    Depending on who this user is, i want to set the editable in to true or false.
    Is there a simple way to do this?

    {text: ‘Comment’, datafield: ‘Comment’, width: 300, editable: true}

    Cheers!

    change editable dynamically #75865

    Peter Stoev
    Keymaster

    Hi Programmerswe,

    You can use the Grid’s method – setcolumnproperty for setting column properties dynamically. For more information, please refer to jqxGrid’s API Documentation.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    change editable dynamically #75891

    Programmerswe
    Participant

    Ive tried yo use

    
    gridComplete: function () {
    	var loggedInUser = document.getElementById("loggedInUser").innerHTML;				
    	if(loggedInUser == "ME"){
    		$('#jqxgrid').jqxGrid('setcolumnproperty', 'Comment', 'editable', true);
    	}
    },
    

    But it didnt work for some reason, but gave me:

    uncaught exception: jqxCore: invalid property ‘gridComplete’

    change editable dynamically #75893

    Peter Stoev
    Keymaster

    Hi Programmerswe,

    We do not have property called gridComplete in our API so such Error is expected. May be you’re looking another third-party product not from our website.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    change editable dynamically #75894

    Programmerswe
    Participant

    Im looking for a way to run the

    
    var loggedInUser = document.getElementById("loggedInUser").innerHTML;				
    	if(loggedInUser == "ME"){
    		$('#jqxgrid').jqxGrid('setcolumnproperty', 'Comment', 'editable', true);
    	}
    

    when the grid is loaded. So i can change the comments editable value depending on which user is logged in on the site.
    Is there a way to do this with anything in your api?

    change editable dynamically #75895

    Peter Stoev
    Keymaster

    Hi Programmerswe,

    You should use “setcolumnproperty” to dynamically change a property. This works so I suggest you to check your own code.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    change editable dynamically #75898

    Programmerswe
    Participant

    I am using the “setcolumnproperty”. The question is where i should use the if statement containing it.

    change editable dynamically #75899

    Peter Stoev
    Keymaster

    Hi Programmerswe,

    I do not know where you should use it in your code. This does not depend on us, but by your implementation’s logic.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    change editable dynamically #75912

    Programmerswe
    Participant

    Got it, thanks for the help, you guys are awesome!

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.