JQUERY GRID

I have a Jquery Grid and a button inside the grid created by a command

Can I hide this button based on a drop down list selection?

I already tried adding an ID and doing the show hide, but this doesn’t work.

hi

need to see what is the code you have done so far … without that not easy to visualize u r problem

Do you have any markup related to this? 

You might try using the Developer Tools (F12) within your browser and consider inspecting the Button that is created (Right-click > Inspect Element) and then see what it looks like and if there is something that you could use to select it through
jQuery and hide it when your DropDownList is changed.

I tried that I used the Class $(‘.class’).hide():

 

And that doesn’t work either.

The button is dynamically created in a Command

command: [
                                { text: "Order", click: loadGrid},
                                { text: "My Report", click: Open},
                               
                    ], title: "", width: "20%"
                }],

The grid loads and there is are two buttons 1 called order and the other called "My Report"

I want the My Report button to disappear, based on my dropdown selection

What exactly does the rendered source for your My Report Button look like? Additionally, I would interested to know if you could set the ID property within your command as well to see if that makes any difference with accessing it :

command: [ { text: "Order", click: loadGrid}, { id: "Example", text: "My Report", click: Open},], title: "", width: "20%"}],

And then using something like :

$("#Example").hide();

or depending on your Grid, you could probably use a very generic selector to hide any Buttons (if you only have one) :

$("#YourDropDownList").change(function(){
     // If your specific value is selected, hide your Button
     $("#YourGridID button").toggle($(this).val() == "Value to Hide The Button");
});

That doesn’t work, already tried.

Could you post what the rendered source of your Button within the Grid looks like?

Leave a Reply