This question is locked. New answers and comments are not allowed.
I have an MVC Grid with Ajax binding and sorting enabled. I also have a textbox in each row with a call to autonumeric.js and another call on blur to a rounding function. This all works great on the initial grid load. After sorting any column the javascript stops firing. Any suggestions?
Javascript:
Grid:
Javascript:
<script type="text/javascript"><!-- // $(document).ready(function () { $('.HoursNew').autoNumeric({ pSign: 's', vMin: '-999.5', vMax: '999.5', mRound: 'C', aPad: false }); $('.HoursNew').blur(function () { roundToHalf(this); }); }); // Round decimal to nearest .5 // v is input object function roundToHalf(v) { var value = v.value; var r; //alert(v.id); var converted = parseFloat(value); // Make sure we have a number var decimal = (converted - parseInt(converted, 10)); // Pull the decimal value decimal = Math.round(decimal * 10); if (decimal == 5) { return (parseInt(converted, 10) + 0.5); } // leave alone if .5 if ((decimal < 3) || (decimal > 7)) { r = Math.round(converted); // Round up or down to nearest whole number } else { r = (parseInt(converted, 10) + 0.5); //round to .5 } //alert(r); // reset input value to new value $('#' + v.id).val(r); } //--></script>Grid: