3d grids numeric with autosum on rows

Is it again about a 3d-grid, now with numeric open end boxes

Everyone, I suppose, knows that I can have the autosum feature enabled for columns. What if I need an autosum on rows?

Here’s a quick script I wrote that takes care of this.

$(".confirmit-grid tbody tr")
.each(function(index){
	var row=index+1;
	var last=$(this).find("input:text").length;
	$(this).find("input:text")
	.each(function(index){
		$(this).keyup(function(){
			if(index+1!=last){
				var sum=0;
				$(".confirmit-grid tr:eq("+row+") input:text").not(':last').each(function(){sum+=parseInt($(this).val()-0);});
				$(".confirmit-grid tr:eq("+row+") input:text").last().val(sum);
			}
		});
	});
});

3 thoughts on “3d grids numeric with autosum on rows”

  1. What is “$”? I tried to put this script in a validation but got the error ‘Variable ‘$’ has not been declared’. It would be awesome if I could do something like this.

    1. yes, sorry I wasn’t clear, this is javascript so please try to add it in the “instruction”

      You should also include the jQuery library first, in the theme you are using,
      like “http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js”, there is a external Javascript in the theme property you can use to load it.

Leave a Reply