@@ -33,6 +33,7 @@ function init(Survey) {
3333 afterRender : function ( question , el ) {
3434 var rootWidget = this ;
3535 el . style . width = "100%" ;
36+ var source , result ;
3637 var resultEl = document . createElement ( "div" ) ;
3738 var emptyEl = document . createElement ( "span" ) ;
3839 var sourceEl = document . createElement ( "div" ) ;
@@ -74,8 +75,9 @@ function init(Survey) {
7475 } ) ;
7576 emptyEl . style . display = wasInResults ? "none" : "" ;
7677 } ;
77- question . resultEl = Sortable . create ( resultEl , {
78+ result = question . resultEl = Sortable . create ( resultEl , {
7879 animation : 150 ,
80+ disabled : question . isReadOnly ,
7981 group : question . name ,
8082 onSort : function ( evt ) {
8183 var result = [ ] ;
@@ -94,16 +96,27 @@ function init(Survey) {
9496 isUpdatingQuestionValue = false ;
9597 }
9698 } ) ;
97- question . sourceEl = Sortable . create ( sourceEl , {
99+ source = question . sourceEl = Sortable . create ( sourceEl , {
98100 animation : 150 ,
101+ disabled : question . isReadOnly ,
99102 group : question . name
100103 } ) ;
101104 question . valueChangedCallback = updateValueHandler ;
105+ question . readOnlyChangedCallback = function ( ) {
106+ if ( question . isReadOnly ) {
107+ result . options . disabled = true ;
108+ source . options . disabled = true ;
109+ } else {
110+ result . options . disabled = false ;
111+ source . options . disabled = false ;
112+ }
113+ } ;
102114 updateValueHandler ( ) ;
103115 } ,
104116 willUnmount : function ( question , el ) {
105117 question . resultEl . destroy ( ) ;
106118 question . sourceEl . destroy ( ) ;
119+ question . readOnlyChangedCallback = null ;
107120 }
108121 } ;
109122
0 commit comments