Is it possible to excecute detachFooter from XML init?

I’m trying to attach some server-generated footer to a grid.
I’m using the XML init:

<head>
 <afterInit>
  <call command="detachFooter"><param>0</param></call>
  <call command="attachFooter"><param>1,2,3,4</param></call>
 </afterInit>
</head>

The first action does not work, the second does. Every time, when the user changes sorting or filtering in grid, the second command adds a footer line. I want to replace the first footer line only, not add new line every time.
Is it possible to execute detachFooter(0) this way?

I solved above problem this way:

grid.attachFooter("");
grid.attachEvent("onXLE", foot);

function foot(g, c) {
   	g.attachFooter(g.getUserData("","sumy"));
	g.detachFooter(0);
   }

In the XML I’m adding something like this:

<userdata name="sumy">1,2,3,4</userdata>

The ordering of commands in foot() is meaningful. If doing detach first, the footer is located badly on the grid. Why?

I think you can add after detach|attach the next call

grid.setSizes();

In such case, the order of operation will not matter.