Script control in UI Design for Preview server Vs MWS

Hi all,
I am using the below java script to control tree behavior.This is working fine in Designer preview server .But when deployed in MWS server this script is not working.Even it is not able to enter in script block.

Below is the simple code for script


CAF.model('#{activePageBean.clientIds["tree"]}').addRowChangeListener(
  function(id, rowId, type) {
  if (type != 'select') {
        return;
    }
    alert("OKKK");
}
);

Getting this alert in preview server but not in mws server when selecting any row in tree.

Is there anything wrong in script block for MWS server.

wM version using is 8.2

Thanks

Is there any difference between syntex
CAF.model(‘#{activePageBean.clientIds[“tree”]}’).addRowChangeListener
and
CAF.model(‘#{caf:cid[“tree”]}’).addRowChangeListener

Thanks