First, let me thank you Leo for providing the toggle button to switch the fill-columns to auto and back to folder default.
People can find it here, in the tutorial thread: Tutorial video: Column resizing & folder formats
The toggle button does not work for me. To be more precise, it's the command in the subject within the button that fails, and it does so whenever on of my script columns is involved.
This may be caused by using ":" in the script/column name, tested other peoples columns and it's ok with those it seems. The command fails if a single column or multiple column names are passed (like in your button).
Set COLUMNSADD=scp:Column.Generic: ModifiedWithin/ModifiedWithin-Graph(!,a,0)
Not sure if this is a DO12 only issue, but I guess I would have noticed my script columns not working in conjunction with Set COLUMNSADD/REMOVE, but I won't bet on it! o)
Aha, so the error is on my side. Very good, I prefer that! o) I was kinda blinded by the colon, overlooking the more obvious space issue.
Indeed, the d-quotes made it work! I tweaked your button a little so it always uses quotes for the Set COLUMNADD command.
function OnClick(clickData){
var colParams = "";
for(var e = new Enumerator(clickData.func.sourcetab.format.columns); !e.atEnd(); e.moveNext()){
var col = e.item();
if (!col.Autosize || col.Max != 0){
if (colParams) colParams += ",";
colParams += col.Name;
colParams += "(!,a,0)"; // Keep position. Auto-size. No maximum.
}
}
var cmd = "Set FORMAT=!folder";
if (colParams) cmd = 'Set COLUMNSADD="'+colParams+'"';
clickData.func.command.RunCommand(cmd);
}