මචන්ලා මම කොම්පැනියකට කොස්ටින් සිස්ටම් එකක් හදනවා.ඒකේදි ඩයිනමික් ටේබල් ගොඩක් එක පිටුවට සෙට් වෙනවා.පලවෙනි ටේබල් එකෙන් බබා වගේ දාපු රෝස් ඩිලීට් කරන්න පුලුවන් ඉන්ඩෙක්ස් -1 අරගෙන.
දෙවනි ටේබල් ආවාම තමා වැඩේ දෙල් උනේ.මේකෙදි ඩිලීට් කරන්න ඔන රෝ එකේ ඉන්ඩෙක්ස් බැලුවාම පෙන්වන්නේ උඩ ඩ්යිනමික් ටේබල් එකේ රෝසුට් එක්කම කවුන්ට් එක
*පලවෙනි ටේබල් එකේ දෙවෙනියට දැම්ම එකේ ඉන්ඩෙක්ස් 2
*ඩිලිට් කරද්දි ඉන්ඩෙක්ස් -1 ගත්තාම ඒ රො ඩිලීට් වෙනවා
*දෙවනි ටේබල් එකේ දෙවෙනියට දැම්ම එකේ ඉන්ඩෙක්ස් එන්නෙ 4 කියලා..මේ නිසා ඩිලිට් කරන්න ඔන රො ඉන්ඩෙක්ස් හරහා ගන්න බැ.මට ඔන දෙවනි ටෙබල් එකෙ දෙවෙනි අයිටම් ගත්තොට් එකෙට් ඉන්ඩෙක්ස් දෙක කියලම ගන්න.මේකට විදියක් තිබේද?
code segments
1st table remove row ----->working
function removeRow(obj){
var mytable = document.getElementById("table_body");
var index = $(obj).parent().parent().index("tr");
var ptot = parseFloat($(obj).parent().prev().text());
var gtot = parseFloat($("#txtta").val());
var dif = parseFloat($("#txtdif").val());
alert(index);
gtot -= ptot;
dif += ptot;
$("#txtta").val(gtot);
$("#txtdif").val(dif);
mytable.deleteRow(index-1);
}
2nd table not working
function removeLabourRow(obj){
var mytable2 = document.getElementById("table_bodylb");
var index2 = $(obj).parent().parent().index("tr");
var ptot2 = parseFloat($(obj).parent().prev().text());
var cost = $("#txttotlcost").val();
cost -= ptot2;
alert(index2);
$("#txttotlcost").val(cost);
mytable2.deleteRow(index2-4);// this part is changing base on number of rows in previous table
}
Error as a video (80s video)
දෙවනි ටේබල් ආවාම තමා වැඩේ දෙල් උනේ.මේකෙදි ඩිලීට් කරන්න ඔන රෝ එකේ ඉන්ඩෙක්ස් බැලුවාම පෙන්වන්නේ උඩ ඩ්යිනමික් ටේබල් එකේ රෝසුට් එක්කම කවුන්ට් එක
*පලවෙනි ටේබල් එකේ දෙවෙනියට දැම්ම එකේ ඉන්ඩෙක්ස් 2
*ඩිලිට් කරද්දි ඉන්ඩෙක්ස් -1 ගත්තාම ඒ රො ඩිලීට් වෙනවා
*දෙවනි ටේබල් එකේ දෙවෙනියට දැම්ම එකේ ඉන්ඩෙක්ස් එන්නෙ 4 කියලා..මේ නිසා ඩිලිට් කරන්න ඔන රො ඉන්ඩෙක්ස් හරහා ගන්න බැ.මට ඔන දෙවනි ටෙබල් එකෙ දෙවෙනි අයිටම් ගත්තොට් එකෙට් ඉන්ඩෙක්ස් දෙක කියලම ගන්න.මේකට විදියක් තිබේද?
code segments
1st table remove row ----->working
function removeRow(obj){
var mytable = document.getElementById("table_body");
var index = $(obj).parent().parent().index("tr");
var ptot = parseFloat($(obj).parent().prev().text());
var gtot = parseFloat($("#txtta").val());
var dif = parseFloat($("#txtdif").val());
alert(index);
gtot -= ptot;
dif += ptot;
$("#txtta").val(gtot);
$("#txtdif").val(dif);
mytable.deleteRow(index-1);
}
2nd table not working
function removeLabourRow(obj){
var mytable2 = document.getElementById("table_bodylb");
var index2 = $(obj).parent().parent().index("tr");
var ptot2 = parseFloat($(obj).parent().prev().text());
var cost = $("#txttotlcost").val();
cost -= ptot2;
alert(index2);
$("#txttotlcost").val(cost);
mytable2.deleteRow(index2-4);// this part is changing base on number of rows in previous table
}
Error as a video (80s video)
Last edited: