You really can't just change the data-* attribute and expect JQM to restyle your page. For the most part, 'refresh' is used when you add new markup (like adding list elements) and want JQM to enhance those new items. Most form element widgets have a method like .checkboxradio() to update the enhanced markup from the underlying native controls. That is, if you change the selected radio button programmatically, you need to call .checkboxradio('refresh') so it will update the enhanced version.
BTW: You really should learn how to use jsfiddle.net so people can see what you've tried. Responding with 'it doesn't work!' doesn't help, since we can't tell if you've applied the solution properly or if particular markup is causing issues. You should create the simplest markup and javascript to identify your problem. That will help everyone out immensely in assisting you.
Anyway, I've created a sample for programmatically collapsing/expanding a collapsible. As you can tell, it's simply a matter of triggering the expand/collapse event on the collapsible. JQM doesn't provide a way to find out if it's collapsed or not, so you have to look too see if a specific class exists.
I have an example here: http://jsfiddle.net/kiliman/pEWJz/
$('#page').bind('pageinit', function(e, data) {
// initialize page
var $page = $(this);
$('#toggle-collapsible').click(function() {
var $collapsible = $('#collapsible'),
isCollapsed = $collapsible.find('.ui-collapsible-heading-collapsed').length > 0;
$collapsible.trigger(isCollapsed ? 'expand' : 'collapse');
});
});
You'll notice a lot in JQM that you will sometimes need to know what the enhanced markup looks like and manipulate that.
For example, there is currently no way to dynamically change the theme once a page is enhanced. You will basically have to go and replace all the classes to use the correct theme. For example, change .ui-body-c to .ui-body-e.
This answer has a great example that shows how to change the themes on various elements.
change jquery mobile color swatch dynamically