Multiple Inserts

The first record i insert works okay. Subsequent records generates two inserts.

toolTBar.attachEvent('onClick', function(id){
		if(id == "allocTool") {
			var toolingDP = new dataProcessor('php/loadEngineerTools.php?engineer='+gridDMN.getSelectedRowId());
			toolingDP.init(gridTooling);
			var uid = gridTooling.uid();
			gridTooling.addRow(uid,gridDMN.getSelectedRowId()+",A",0);
			gridTooling.selectRow(0);
		}
	});

The log file produces two inserts:


====================================
Log started, 26/03/2013 11:03:09
====================================

SELECT `ID`,`ID` as value,`TOOL` as label FROM tbltools

SELECT DISTINCT `MAKE` as value FROM tblallocatetools WHERE ( STATUS = 'A' AND CID=1)

SELECT DISTINCT `MODEL` as value FROM tblallocatetools WHERE ( STATUS = 'A' AND CID=1)

SELECT  * FROM tblallocatetools WHERE ( STATUS = 'A' AND CID=1)

Done in 0.016411066055298s



====================================
Log started, 26/03/2013 11:03:12
====================================

SELECT  * FROM tblallocatetools WHERE ( STATUS = 'A' AND CID=8)

Done in 0.0039079189300537s



====================================
Log started, 26/03/2013 11:03:16
====================================

DataProcessor object initialized
1364293275323_gr_id => 1364293275323
1364293275323_c0 => 8
1364293275323_c1 => A
1364293275323_c2 => 
1364293275323_c3 => 
1364293275323_c4 => 
1364293275323_c5 => 
1364293275323_c6 => 
1364293275323_c7 => 
1364293275323_!nativeeditor_status => inserted
ids => 1364293275323

Row data [1364293275323]
ID => 1364293275323
CID => 8
STATUS => A
TID => 
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 
!nativeeditor_status => inserted

INSERT INTO tblallocatetools(`CID`,`STATUS`,`TID`,`MAKE`,`MODEL`,`SERIAL`,`CAL`,`ISSUED`) VALUES ('8','A','','','','','','')

Edit operation finished
0 => action:inserted; sid:1364293275323; tid:104;

Done in 0.16521596908569s



====================================
Log started, 26/03/2013 11:03:19
====================================

DataProcessor object initialized
104_gr_id => 104
104_c0 => 8
104_c1 => A
104_c2 => 3
104_c3 => 
104_c4 => 
104_c5 => 
104_c6 => 
104_c7 => 
104_!nativeeditor_status => updated
ids => 104

Row data [104]
ID => 104
CID => 8
STATUS => A
TID => 3
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 
!nativeeditor_status => updated

UPDATE tblallocatetools SET `CID`='8',`STATUS`='A',`TID`='3',`MAKE`='',`MODEL`='',`SERIAL`='',`CAL`='',`ISSUED`='' WHERE `ID`='104' AND (( STATUS = 'A' AND CID=8))

Edit operation finished
0 => action:updated; sid:104; tid:104;

Done in 0.18358683586121s



====================================
Log started, 26/03/2013 11:03:23
====================================

DataProcessor object initialized
104_gr_id => 104
104_c0 => 8
104_c1 => A
104_c2 => 3
104_c3 => 
104_c4 => 
104_c5 => 
104_c6 => 
104_c7 => 2013-03-26
104_!nativeeditor_status => updated
ids => 104

Row data [104]
ID => 104
CID => 8
STATUS => A
TID => 3
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 2013-03-26
!nativeeditor_status => updated

UPDATE tblallocatetools SET `CID`='8',`STATUS`='A',`TID`='3',`MAKE`='',`MODEL`='',`SERIAL`='',`CAL`='',`ISSUED`='2013-03-26' WHERE `ID`='104' AND (( STATUS = 'A' AND CID=8))

Edit operation finished
0 => action:updated; sid:104; tid:104;

Done in 0.16816592216492s



====================================
Log started, 26/03/2013 11:03:28
====================================

DataProcessor object initialized
1364293275324_gr_id => 1364293275324
1364293275324_c0 => 8
1364293275324_c1 => A
1364293275324_c2 => 
1364293275324_c3 => 
1364293275324_c4 => 
1364293275324_c5 => 
1364293275324_c6 => 
1364293275324_c7 => 
1364293275324_!nativeeditor_status => inserted
ids => 1364293275324

Row data [1364293275324]
ID => 1364293275324
CID => 8
STATUS => A
TID => 
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 
!nativeeditor_status => inserted

INSERT INTO tblallocatetools(`CID`,`STATUS`,`TID`,`MAKE`,`MODEL`,`SERIAL`,`CAL`,`ISSUED`) VALUES ('8','A','','','','','','')



====================================
Log started, 26/03/2013 11:03:28
====================================

Edit operation finished
0 => action:inserted; sid:1364293275324; tid:105;

Done in 0.15317416191101s

DataProcessor object initialized
1364293275324_gr_id => 1364293275324
1364293275324_c0 => 8
1364293275324_c1 => A
1364293275324_c2 => 
1364293275324_c3 => 
1364293275324_c4 => 
1364293275324_c5 => 
1364293275324_c6 => 
1364293275324_c7 => 
1364293275324_!nativeeditor_status => inserted
ids => 1364293275324

Row data [1364293275324]
ID => 1364293275324
CID => 8
STATUS => A
TID => 
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 
!nativeeditor_status => inserted

INSERT INTO tblallocatetools(`CID`,`STATUS`,`TID`,`MAKE`,`MODEL`,`SERIAL`,`CAL`,`ISSUED`) VALUES ('8','A','','','','','','')

Edit operation finished
0 => action:inserted; sid:1364293275324; tid:106;

Done in 0.20157790184021s



====================================
Log started, 26/03/2013 11:03:32
====================================

DataProcessor object initialized
105_gr_id => 105
105_c0 => 8
105_c1 => A
105_c2 => 29
105_c3 => 
105_c4 => 
105_c5 => 
105_c6 => 
105_c7 => 
105_!nativeeditor_status => updated
ids => 105

Row data [105]
ID => 105
CID => 8
STATUS => A
TID => 29
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 
!nativeeditor_status => updated

UPDATE tblallocatetools SET `CID`='8',`STATUS`='A',`TID`='29',`MAKE`='',`MODEL`='',`SERIAL`='',`CAL`='',`ISSUED`='' WHERE `ID`='105' AND (( STATUS = 'A' AND CID=8))



====================================
Log started, 26/03/2013 11:03:32
====================================

Edit operation finished
0 => action:updated; sid:105; tid:105;

Done in 0.17305493354797s

DataProcessor object initialized
105_gr_id => 105
105_c0 => 8
105_c1 => A
105_c2 => 29
105_c3 => 
105_c4 => 
105_c5 => 
105_c6 => 
105_c7 => 
105_!nativeeditor_status => updated
ids => 105

Row data [105]
ID => 105
CID => 8
STATUS => A
TID => 29
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 
!nativeeditor_status => updated

UPDATE tblallocatetools SET `CID`='8',`STATUS`='A',`TID`='29',`MAKE`='',`MODEL`='',`SERIAL`='',`CAL`='',`ISSUED`='' WHERE `ID`='105' AND (( STATUS = 'A' AND CID=8))

Edit operation finished
0 => action:updated; sid:105; tid:105;

Done in 0.22854804992676s



====================================
Log started, 26/03/2013 11:03:36
====================================



====================================
Log started, 26/03/2013 11:03:36
====================================

DataProcessor object initialized
105_gr_id => 105
105_c0 => 8
105_c1 => A
105_c2 => 29
105_c3 => 
105_c4 => 
105_c5 => 
105_c6 => 
105_c7 => 2013-03-26
105_!nativeeditor_status => updated
ids => 105

Row data [105]
ID => 105
CID => 8
STATUS => A
TID => 29
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 2013-03-26
!nativeeditor_status => updated

UPDATE tblallocatetools SET `CID`='8',`STATUS`='A',`TID`='29',`MAKE`='',`MODEL`='',`SERIAL`='',`CAL`='',`ISSUED`='2013-03-26' WHERE `ID`='105' AND (( STATUS = 'A' AND CID=8))

Edit operation finished
0 => action:updated; sid:105; tid:105;

Done in 0.16455411911011s

DataProcessor object initialized
105_gr_id => 105
105_c0 => 8
105_c1 => A
105_c2 => 29
105_c3 => 
105_c4 => 
105_c5 => 
105_c6 => 
105_c7 => 2013-03-26
105_!nativeeditor_status => updated
ids => 105

Row data [105]
ID => 105
CID => 8
STATUS => A
TID => 29
MAKE => 
MODEL => 
SERIAL => 
CAL => 
ISSUED => 2013-03-26
!nativeeditor_status => updated

UPDATE tblallocatetools SET `CID`='8',`STATUS`='A',`TID`='29',`MAKE`='',`MODEL`='',`SERIAL`='',`CAL`='',`ISSUED`='2013-03-26' WHERE `ID`='105' AND (( STATUS = 'A' AND CID=8))

Edit operation finished
0 => action:updated; sid:105; tid:105;

Done in 0.2115159034729s



====================================
Log started, 26/03/2013 11:03:22
====================================

SELECT `ID`,`ID` as value,`TOOL` as label FROM tbltools

SELECT DISTINCT `MAKE` as value FROM tblallocatetools WHERE ( STATUS = 'A' AND CID=1)

SELECT DISTINCT `MODEL` as value FROM tblallocatetools WHERE ( STATUS = 'A' AND CID=1)

SELECT  * FROM tblallocatetools WHERE ( STATUS = 'A' AND CID=1)

Done in 0.01465892791748s



====================================
Log started, 26/03/2013 11:03:24
====================================

SELECT  * FROM tblallocatetools WHERE ( STATUS = 'A' AND CID=8)

Done in 0.0040390491485596s

You must not create dataprocessor for each click. Create it once and just add rows from onclick handler

var toolingDP = new dataProcessor('php/loadEngineerTools.php?engineer='+gridDMN.getSelectedRowId()); toolingDP.init(gridTooling); ... toolTBar.attachEvent('onClick', function(id){ if(id == "allocTool") { var uid = gridTooling.uid(); gridTooling.addRow(uid,gridDMN.getSelectedRowId()+",A",0); gridTooling.selectRow(0); } });