It probably won’t work because when you click on your custom button to update the grid, your custom button gets replaced by the new partial view, and so the javascript bound to it also disappears!
Try using clientChange in your button options instead.
No, I think I was wrong - according to the clientChange documentation what you’ve got there should be ok, since the ‘live’ option defaults to true.
I think you’ll have to look at the html source code for the generated page to see what is happening. Specifically look for the javascript that binds to the click event to see that everything is ok. If you don’t find it, post the generated html code here.
One thing, maybe - do you need to give each button a unique id for the live binding to work - I can’t see how a live binding can work without a selector that allows it to find the button when it is replaced.
Perhaps you would be better off just giving the button a class, without any ajax, then using delegate to bind to all buttons of that class after your widget (which is better jquery coding practice anyway).
Looking at that, I presume you have 5 items per page.
What do you mean by inserting a new row? How do you do that? If you’re doing it yourself using some javascript, then I would say that it’s normal that your button isn’t working, since it won’t have had the event handler assigned to it.
If you’re just changing pages through ajax and finding that the button then doesn’t work, you’ll need to look at the id assigned to the buttons (since you can see that is how it does the delegation).
In all cases, I still think you’d be better off not setting your javascript on a per button basis, but just adding a class and making a delegation for that class after your CGridView.
I do not have five items per page. what I showed you the page’s source code after I inserted a row. it is also the newly inserted row. the row is inserted through the display of a dialog form which in turn makes an ajax call.
if I change the page using ajax and then pressed again the same button, it works.
Then suggest to create a js function to switch the task to make the ajax request if I understand correctly?
If jQuery is undefined after you use an ajax link on a GridView, I can only assume that there must be something wrong with your rendering parameters.
However, it’s very difficult to know without seeing code.
I suggest that either you follow through the debugging to find out why and at what stage jQuery is no longer defined, or post all your code here (action, view and model if you’ve customised anything).