Wednesday, November 27, 2013

Another Way To addrow in datatable using Jquery

Antecedents/Triggers Consequences Timing Consistency
function addRow() { var tbl = document.getElementById('tbl'); var Row = parseInt(document.getElementById('hsb').value); var temprow=Row+1; var mainRow = tbl.insertRow(temprow); var trId ="tr"+temprow; mainRow.id=trId; var td = document.createElement("td"); td.colSpan='6'; var table = document.createElement("table"); table.border="0"; table.cellPadding="0"; table.cellSpacing="1"; table.width="100%" var newRow = table.insertRow(0); var sec = "'risk'"; var newCell = newRow.insertCell(0); newCell.width="50%" newCell.innerHTML = ' var newCell = newRow.insertCell(1); newCell.width="17%" newCell.innerHTML = ''; var newCell = newRow.insertCell(2); newCell.width="10%" newCell.innerHTML = ''; var newCell = newRow.insertCell(3); newCell.width="10%" newCell.innerHTML = ''; td.appendChild(table); mainRow.appendChild(td); document.getElementById('hsb').value=temprow; }

Adding,Deleting Row in gridview using Jquery (Very Effective)


Records
Company Product Model State City Quantity Contact Mail ID


Select
Jqueyy code: $(document).ready( function () { $("#DuplicateRow").click( function () { var checkboxValues = []; $('input[type="checkbox"]:checked').each( function () { var $chkbox = $(this); var $actualrow = $chkbox.closest('tr'); var $clonedRow = $actualrow.clone(); $clonedRow.find("select").each( function (i) { this.selectedIndex = $actualrow.find("select")[i].selectedIndex; } ) $chkbox.closest('#tabletomodify').append($clonedRow); } ); } ); $("#DeleteRow").click( function () { var checkboxValues = []; $('input[type="checkbox"]:checked').each( function () { var $chkbox = $(this); $(this).closest("tr").remove(); } ); } ); $("#AddRow").click( function () { var row = document.getElementById("row"); // find row to copy var table = document.getElementById("tabletomodify"); // find table to append to var clone = row.cloneNode(true); // copy children too clone.id = "row"; // change id or other attributes/contents table.appendChild(clone); // add new row to end of table } ); $('#tabletomodify').on('change','.selcompany', function () { var optionSelected = $("option:selected", this); var valueSelected = this.value; alert(valueSelected); }); } );

Friday, November 22, 2013

Object Object , Json Parse Problem in jquery

success: function(msg) { alert("{Pid:'"+ faram+"'}"); var orders =msg; if (orders.length > 0) { alert(orders.length ); test(orders); } function test(data) { for (i in data) { for (k in data[i]) { alert(data[i][k]); } }