Marked Cell


In following script I have a strange result when using onCellMarked event.

  1. clicked in a cell it displays row ID. (it’s correct)
  2. clikced on button proceed, it displays row ID. (also correct)
  3. clicked another cell (on another row). it displays new rowID. (correct)
  4. clicked on button proceed. it displays first rowID of step 1, then rowID of step 2.

How can I, if clicked on proceed, only show last marked rowID


var mygrid,toolbar,workflow,gwid,openWindow,overzichtgrid,menu,celregel; dhtmlxEvent(window,"load",function(){ var main_layout = new dhtmlXLayoutObject(document.body, '2E'); var a = main_layout.cells('a'); var b = main_layout.cells('b'); overzichtgrid = a.attachGrid(); overzichtgrid.setHeader("A,B,1,2,3,4,5,6,7,8,9,10,11,12,13,14");//set column names overzichtgrid.init(); overzichtgrid.setStyle("","border: 1px solid black;","background-color:red;", ""); overzichtgrid.enableMarkedCells(true); var js={rows:[ { id:1,data:["1-A","1-B","1-1","1-2","1-3","1-4","1-5","1-6","1-7","1-8","1-9","1-10","1-11","1-12","1-13","1-14" ]}, { id:2,data:["2-A","2-B","2-1","2-2","2-3","2-4","2-5","2-6","2-7","2-8","2-9","2-10","2-11","2-12","2-13","2-14" ]}, { id:3,data:["3-A","3-B","3-1","3-2","3-3","3-4","3-5","3-6","3-7","3-8","3-9","3-10","3-11","3-12","3-13","3-14" ]}]}; formData = [{type:"button", name:"save", value:"Proceed"}] overzichtgrid.parse(js,"json") var aktform = b.attachForm(formData); overzichtgrid.attachEvent("onCellMarked", function(rid,ind){ alert ('alert1- '+ rid); aktform.attachEvent("onButtonClick", function(id){ alert ('alert2- '+ rid); }); }); })

attaching the onButtonClick event in the onCellMarked event will lead to onButtonClick event clonning.
Please, try to replace the onButtonClick event out of the onCellMarked and get the marked cells using the getMarked() method:
var markedArray = mygrid.getMarked();

Thanx Sematik,

That was the trick.