refresh counter col

Hi,
how can I force the refresh of a column type "cnrt " ?
When I insert a row in a grid, I get the counter duplicate. If I perform the sorting of a column, then the counter returns correct.
thks

[code]

online var myGrid;

var myGrid;
function doOnLoad(){
myGrid = new dhtmlXGridObject(‘gridbox’);
myGrid.setImagePath(“dhtmlx/codebase/imgs/dhxgrid_skyblue/”);
myGrid.setHeader(“a, Denominazione-modello-costruttore,Matricola e anno di costruzione,Campo di misura/prova in cui lo strumento &egrave utilizzato,Cat.,Centro di taratura, ente presso il quale il centro &egrave accreditato e numero di accreditamento (2),Frequenza di taratura”);
myGrid.setInitWidths(“20,200,200,200,50,200,200,200”);
myGrid.setColAlign(“left,left,left,left,left,left,left”);
myGrid.setColTypes(“cntr,ed,ed,ed,ed,ed,ed,ed”);
myGrid.setColSorting(" str,str,str,str,str,str,str,str");
myGrid.setColValidators(",ValidInteger");

		myGrid.init();
		//myGrid.load("../common/grid_16_rows_columns_manipulations.xml");
	}
	function add_i(){

		myGrid.addRow(myGrid.uid(),[,myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum()],myGrid.getRowIndex(myGrid.getSelectedRowId()));
		
	}
	function add_d(){

		myGrid.addRow(myGrid.uid(),[,myGrid.cells(myGrid.getSelectedRowId(), 1).getValue(),myGrid.cells(myGrid.getSelectedRowId(), 2).getValue(),myGrid.cells(myGrid.getSelectedRowId(), 3).getValue(),myGrid.cells(myGrid.getSelectedRowId(), 4).getValue(),myGrid.cells(myGrid.getSelectedRowId(), 5).getValue(),myGrid.cells(myGrid.getSelectedRowId(), 6).getValue(),myGrid.cells(myGrid.getSelectedRowId(), 7).getValue()],myGrid.getRowIndex(myGrid.getSelectedRowId()));
		
	}
	function add_r(){

		myGrid.addRow(myGrid.uid(),[,myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum(),myGrid.getRowsNum()]);
	}
	function delete_r() {

		myGrid.deleteRow(myGrid.getSelectedRowId());}
	function ser(){
		myGrid.setSerializationLevel(false,false,true);
		document.getElementById("alfa1").innerHTML=myGrid.serialize().replace(/\</g,"&lt;").replace(/\>/g,"&gt;").replace(/\&lt;row/g,"<br/>&lt;row");
	}
</script>
<div id="gridbox" style="width:1200px; height:270px; background-color:white;"></div>
<a href='#alfa' onClick="if(myGrid.setSerializationLevel){ser();} else {alert('Available in Pro Edition only')}">Serialize grid</a>
<a name="alfa">
	<div id="alfa1"></div>
</a>
<table width="375">
	<tr>
		<td>
			<li><a href="#" onclick="add_i()">insert before selected row</a></li>
			<li><a href="#" onclick="add_d()">Duplica la riga  selezionata</a></li>
			<li><a href="#" onclick="add_r()">Aggiungi una riga vuota alla lista</a></li>
			<li><a href="#" onclick="delete_r()">Cancella la riga selezionata</a></li>
		</td>
	</tr>
</table>
[/code]

Please, try to call:
myGrid.resetCounter(0);

so it works fine !!!
sematik thank you !

Can’t seem to make the counter resetting work with the code below. Are there any unique setup requirements other than column type “cntr” to make it work?

grid.attachEvent("onAfterRowDeleted", function(rId, pId) { scheduleGrid.resetCounter(0); });

Why isn’t the above code working (the “cntr” doesn’t reset)?

Oops! Typo there, it should be “grid”, not “scheduleGrid”.

By the way, does resetCounter() only work with XML data source (I use the “js” input format, not XML).

resetCounter() method is independent on the input data format.

@sematik, thanks for the input. I got it to work (simply missed the correct index to use).