I have the following scenario:

There are two columns and aroung 50 rows in my grid and the first column stores items and the second column the values of present stock. So the data would look like: pen - 10, paper - 350, …

Iam trying to display the total stock of each item in my footer. How can i traverse the grid rows and columns and check the item and then add the stock value to the corresponding totoal??

You can calculate it as
    var total=0;

Also, in latest version of grid, you can enable auto-total calculation - just include dhtmlxgrid_filter.js and set next value in footer