Changeset 16918
- Timestamp:
- 06/26/13 20:30:01 (11 years ago)
- Location:
- schedule
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/function/SplitDelete.php
r16913 r16918 1 1 <script type="text/javascript"> 2 2 $(document).ready(function(){ 3 var name ='';4 var value ='';3 var name; 4 var value; 5 5 var timeValue; 6 6 var meas; 7 7 var meas2; 8 var x=0; 9 var measurement=0; 8 10 var getTableId; 9 11 var is=0; … … 282 284 getTableId =get; 283 285 name="name"; value = '#table2'; 286 measurement = 0; 284 287 meas = "class"; meas2 = "time"; //getTableId = $(this).attr('name'); 285 288 split2(); }else{ alert("please enter value for time to add measurement"); } … … 343 346 aa = $(this).val(); 344 347 }); 345 if(aa != ""){ timeValue =aa; name="name"; value=$(this).attr('name'); meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); }348 if(aa != ""){ timeValue =aa; name="name"; value=$(this).attr('name'); measurement = 1; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 346 349 347 350 … … 462 465 getTableId =get; 463 466 name="name"; value = '#table1'; 464 467 measurement = 0; 465 468 meas = "class"; meas2 = "time"; //getTableId = $(this).attr('name'); 466 469 split2(); }else{ alert("please enter value for time to add measurement"); } … … 525 528 }); 526 529 527 if(aa != ""){ timeValue = aa; name="name"; value="#table1"; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); }530 if(aa != ""){ timeValue = aa; name="name"; value="#table1"; measurement=1; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 528 531 529 532 … … 577 580 table.setAttribute('id',"table"+cnt); 578 581 table.setAttribute('width','100%'); 579 table.setAttribute(name,value);582 if(measurement==1){ table.setAttribute(name,value); } 580 583 var tr = document.createElement('tr'); 581 584 tr.setAttribute('id',''); … … 604 607 button.setAttribute('id','btnAddTime'), 605 608 button.setAttribute(meas,meas2), 606 button.setAttribute('name',' #table'+cnt),609 button.setAttribute('name','table'+cnt), 607 610 608 611 button.onclick=function(){ … … 611 614 aa = $(this).val(); 612 615 }); 613 bb = $(this).closest('table').attr('name'); 616 617 if(value == 'undefined'){ bb = $(this).closest('table').attr('name'); }else{ 618 bb = value; } 614 619 if(aa != ""){var splitting = aa.split(':'); var add = 01; 615 620 … … 630 635 var s = 0; var get; 631 636 var nn; 632 nn = bb;637 nn = '#'+$(this).attr("name"); 633 638 $("table").each(function() { 634 639 if($(this).attr("name")==nn){ … … 645 650 646 651 name="name"; value = bb; 647 meas = "class"; meas2 = "time"; getTableId = get; split1(); }else{ alert("please enter value for time to add measurement"); }652 meas = "class"; meas2 = "time"; getTableId = get; measurement =0; split1(); }else{ alert("please enter value for time to add measurement"); } 648 653 649 654 … … 702 707 button.setAttribute('name','#table'+cnt), 703 708 button.onclick=function(){ 704 var aa ;705 var bb ;709 var aa,cc=0; 710 var bb,dd; 706 711 $('div#TableHolder #table'+cnt+' #Time').each(function(){ 707 712 aa = $(this).val(); 713 714 715 708 716 }); 709 bb = $(this).closest('table').attr('name'); 717 dd= $(this).attr('name'); 718 //alert(dd); 719 if($('div#TableHolder '+dd+' #Time').is(':visible')){ 720 cc=0; 721 //alert(cc); 722 }else{ 723 cc=1; 724 } 725 //alert(value); 726 x = 1; 727 if(meas2 == 'time' && measurement == 0 && cc != 1){ bb = '#'+$(this).closest('table').attr('id'); }else{ 728 bb = value; } 710 729 if(aa != "") 711 730 { … … 717 736 meas2 = true; 718 737 getTableId = $(this).attr('name'); 738 //alert(getTableId); 739 measurement = 1; 719 740 split1(); 720 741 } … … 772 793 table.setAttribute('id',"table"+cnt); 773 794 table.setAttribute('width','100%'); 774 table.setAttribute(name,value);795 if(measurement==1){ table.setAttribute(name,value); } 775 796 var tr = document.createElement('tr'); 776 797 tr.setAttribute('id',''); … … 797 818 button.setAttribute('id','btnAddTime'), 798 819 button.setAttribute(meas,meas2), 799 button.setAttribute('name',' #table'+cnt),820 button.setAttribute('name','table'+cnt), 800 821 801 822 button.onclick=function(){ … … 804 825 aa = $(this).val(); 805 826 }); 806 bb = $(this).closest('table').attr('name'); 827 if(value == 'undefined'){ bb = $(this).closest('table').attr('name'); }else{ 828 bb = value; } 807 829 if(aa != ""){ var splitting = aa.split(':'); var add = 01; 808 830 … … 835 857 }); 836 858 837 name="name"; value=bb; meas = "class"; meas2 = "time"; getTableId = get; split1(); }else{ alert("please enter value for time to add measurement"); }859 name="name"; value=bb; measurement=0; meas = "class"; meas2 = "time"; getTableId = get; split1(); }else{ alert("please enter value for time to add measurement"); } 838 860 839 861 … … 890 912 button.setAttribute('type','button'), 891 913 button.setAttribute('value','[+]'), 892 button.setAttribute('id','btnAddTime '),914 button.setAttribute('id','btnAddTimes'), 893 915 button.setAttribute('name','#table'+cnt), 894 916 button.onclick=function(){ 895 917 896 var aa ;897 var bb ;918 var aa,cc=0; 919 var bb,dd; 898 920 $('div#TableHolder #table'+cnt+' #Time').each(function(){ 899 921 aa = $(this).val(); 922 900 923 }); 901 902 bb = $(this).closest('table').attr('name'); 924 dd= $(this).attr('name'); 925 if($('div#TableHolder '+dd+' #Time').is(':visible')){ 926 cc=0; 927 //alert(cc); 928 }else{ 929 cc=1; 930 } 931 x=1; 932 if(meas2 == 'time' && measurement == 0 && cc!=1){ bb = '#'+$(this).closest('table').attr('id'); }else{ 933 bb = value; } 903 934 904 935 if(aa != "") … … 911 942 meas2 = true; 912 943 getTableId = $(this).attr('name'); 944 measurement =1; 913 945 split1(); 914 946 } -
schedule/js/function.js
r16915 r16918 18 18 Table.push(id); 19 19 }); 20 alert(Table); 20 21 GetSaveData(Time,Data,Source,Measure); // Function call of saving the data 22 }); 23 24 /*$('#update').click(function(){ 25 Time = []; 26 Data = []; 27 Source = []; 28 Measure = []; 29 Table = []; 30 $('div#TableHolder table').each(function(){ 31 id=$(this).attr('id'); 32 Table.push(id); 33 Time.push('#'+id+' input#Time'); 34 Data.push('#'+id+' input#txtData'); 35 Source.push('#'+id+' select#source :selected'); 36 Measure.push('#'+id+' select#measurement :selected'); 37 Table.push(id); 38 }); 21 39 alert(Table); 22 }); 40 GetUpdatedData(Time,Data,Source,Measure); 41 });*/ 42 23 43 24 44 }; … … 33 53 for(i=0;i<$('div#TableHolder table').length;i++) 34 54 { 55 //Table[i].val(); 35 56 $(Time[i]).each(function(){ 36 57 TimeSave.push($(this).val()); // extracting each data into a value … … 45 66 MeasureSave.push($(this).val()); // extracting each data into a value 46 67 }); 68 alert(DataSave); 47 69 } 48 70 if($('#save').val()=='UPDATE') … … 93 115 94 116 }; 117 /* 118 function GetUpdatedData(Time,Data,Source,Measure){ 119 var checks=0; 120 TimeSave = []; 121 DataSave = []; 122 SourceSave = []; 123 MeasureSave = []; 124 for(i=0;i<Time.length;i++) 125 { 126 $(Time[i]).each(function(){ 127 TimeSave.push($(this).val()); 128 }); 129 $(Data[i]).each(function(){ 130 DataSave.push($(this).val()); 131 }); 132 $(Source[i]).each(function(){ 133 SourceSave.push($(this).val()); 134 }); 135 $(Measure[i]).each(function(){ 136 MeasureSave.push($(this).val()); 137 }); 138 } 139 if(checks == 0) 140 { 141 $.ajax({ 142 type: "POST", 143 cache: false, 144 url: "Transaction/update.php", 145 data: "Time="+TimeSave+'&Source='+SourceSave+'&measure='+MeasureSave+'&Data='+DataSave+'&Date='+year+'-'+month+'-'+day, 146 success: function(data) { 147 alert('Successfully updated ! '+year+'-'+month+'-'+day); 148 } 149 }); 150 } 151 else 152 { 153 154 alert("Please fill all the details!"); 155 } 156 }*/
Note:
See TracChangeset
for help on using the changeset viewer.