$('#df_SubformTable_BasketLine input').bind('paste', function (e) { if (pasteInProgress) return; pasteInProgress = true; var clipped = ''; //paste multiple lines from clipboard into one cell adds more cells if (window.clipboardData) { clipped = window.clipboardData.getData('Text'); } else { clipped = e.originalEvent.clipboardData.getData('text'); } clipped = clipped.replace(/(\r\n|\n|\r)/gm, "||"); //replace newlines with markers var list = clipped.split('||'); if (list.length > 0) { //first line, paste target $(this).val(list[0]); updateProductRow($(this).closest('tr')); for (var sc = 1; sc < list.length; sc++) { AddProduct(list[sc],''); } AddProduct('', ''); } window.setTimeout(function () {pasteInProgress = false; }, 500); return false; //cancel the pasting event }); $('#df_SubformTable_BasketLine input').bind('keydown', function (e) { var keyCode = e.keyCode || e.which; if (keyCode == 13) { //enter key var row = $(this).closest('tr'); HandleAddNewRow(); //add a new row updateProductRow(row); e.preventDefault(); return false; } });
Leave a Comment
Comments