Update js/grid.base.js

improving performance of local sorting