Close action for popup forms

just built my first popup it would be nice to have a “close” action next to the “save” and “cancel”, or to be able to make “save” do “save and close” clicking on the x seems a little lame

Ken, if you implement Save and Cancel as an action in the page title, and then look in the “Advanced” section of the Action Properties, you will see fields for redirect URL’s. This will allow you to save and close the popup in one action. Three cheers for summer release!

Rob, That works, but is not usable… I start from a page using a table, that displays a filtered list of records… i click on a row, open the popup form… make an edit if i do “save” in the way you suggest, it saves, closes the popup form and then it resets the parent form to being blank, thus destroying my filters and i have to start all over again with just the “save” button on the field editor, i have to first “save” then “x” the popup, but at least my filtered recordset is preserved don’t mistake me… the popups are great… just need a few refinements

Ken, definitely agree about needing a “Save and Close” action or something like that. One thing that’s may help your users is that the “Escape” key will close whatever popup you’re in — I’ve found this makes it pretty quick to open a popup, make some changes, save, then get out quicker then clicking the X.

I think I’m after the same thing as Ken. I’m looking for “save and close the popup and just refresh the data in my table without upsetting my filters or refreshing the whole page”.

I have used this syntax in the past, and it has worked fine :

var popup = params.component.editor.element.closest(’.ui-dialog-content’);
popup.dialog(‘destroy’);
popup.remove();

I just tried using it on a new page that I’m working on. I got this error in the console :

Uncaught TypeError: Cannot read property ‘editor’ of undefined

here is my complete code :

var params = arguments[0],   $ = skuid.$;
var tierGroupModel = skuid.$M(‘TierGroup’);
var newTierGroupModel = skuid.$M(‘NewTierGroup’);
var tierGroupRow = newTierGroupModel.getFirstRow();
var Id = newTierGroupModel.getFieldValue(tierGroupRow,‘Id’,true);
var newTierRateModel = skuid.$M(‘NewTierRates’);
var tierRateRow = newTierRateModel.getFirstRow();
$.each(newTierRateModel.data, function(i,row){
    newTierRateModel.updateRow(row,‘Tier_Group__c’,Id);
});
newTierRateModel.save({callback:function(result){
    if(result.totalsuccess){
        tierGroupModel.updateData();
    }
}});
var popup = params.component.editor.element.closest(’.ui-dialog-content’);
popup.dialog(‘destroy’);
popup.remove();

The records are getting saved fine, but the popup will not close. Just to explain a little, the line “tierGroupModel.updateData();” is intended to update a model/table outside of the popup on the parent page.

A more reliable method of getting the popup, since there should only be one active popup, would be:

var popup = skuid.$(’.ui-dialog-content’);

I would use this instead

Thanks it works!