File tree Expand file tree Collapse file tree 3 files changed +66
-22
lines changed Expand file tree Collapse file tree 3 files changed +66
-22
lines changed Original file line number Diff line number Diff line change @@ -104,9 +104,17 @@ class: 'action-default primary add',
104104
105105 ensureGridIsSet(10000).then(function(){
106106 var grid = window['post_idsJsObject'];
107- grid.reloadParams = {
108- 'selected_posts[]': window.postState
109- };
107+
108+ if (window.postState.length) {
109+ grid.reloadParams = {
110+ 'selected_posts[]': window.postState
111+ };
112+ }
113+ else {
114+ grid.reloadParams = {
115+ 'selected_posts[]': ['-1']
116+ };
117+ }
110118 });
111119 });
112120 })}); " ;
Original file line number Diff line number Diff line change @@ -63,10 +63,16 @@ protected function _prepareCollection() : Grid
6363 public function getRowInitCallback () : string
6464 {
6565 return 'function (grid, element,checked) {
66- grid.reloadParams = {
67- "selected_posts[]": window.postState
68- };
69-
66+ if (window.postState.length) {
67+ grid.reloadParams = {
68+ "selected_posts[]": window.postState
69+ };
70+ }
71+ else {
72+ grid.reloadParams = {
73+ "selected_posts[]": ["-1"]
74+ };
75+ }
7076 }
7177 ' ;
7278 }
@@ -137,11 +143,18 @@ function (grid, event) {
137143 window.postState.splice(index, 1);
138144 }
139145 }
140-
141- grid.reloadParams = {
142- "selected_posts[]": window.postState
143- };
144-
146+
147+ if (window.postState.length) {
148+ grid.reloadParams = {
149+ "selected_posts[]": window.postState
150+ };
151+ }
152+ else {
153+ grid.reloadParams = {
154+ "selected_posts[]": ["-1"]
155+ };
156+ }
157+
145158 grid.setCheckboxChecked(checkbox[0], checked);
146159 }
147160 }
@@ -180,10 +193,19 @@ public function getCheckboxCheckCallback() : string
180193 window.postState.splice(index, 1);
181194 }
182195 }
196+
183197
184- grid.reloadParams = {
185- "selected_posts[]": window.postState
186- };
198+ if (window.postState.length) {
199+ grid.reloadParams = {
200+ "selected_posts[]": window.postState
201+ };
202+ }
203+ else {
204+ grid.reloadParams = {
205+ "selected_posts[]": ["-1"]
206+ };
207+ }
208+
187209 } ' ;
188210 }
189211
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ public function getRowInitCallback() : string
121121
122122 if(!currentState) {
123123 grid.reloadParams = {
124- "selected_posts[]": ""
124+ "selected_posts[]": ["-1"]
125125 };
126126 }
127127 else {
@@ -190,9 +190,16 @@ function (grid, event) {
190190 }
191191 }
192192
193- grid.reloadParams = {
194- "selected_posts[]": window.postState
195- };
193+ if (window.postState.length) {
194+ grid.reloadParams = {
195+ "selected_posts[]": window.postState
196+ };
197+ }
198+ else {
199+ grid.reloadParams = {
200+ "selected_posts[]": ["-1"]
201+ };
202+ }
196203
197204 grid.setCheckboxChecked(checkbox[0], checked);
198205 }
@@ -233,9 +240,16 @@ public function getCheckboxCheckCallback() : string
233240 }
234241 }
235242
236- grid.reloadParams = {
237- "selected_posts[]": window.postState
238- };
243+ if (window.postState.length) {
244+ grid.reloadParams = {
245+ "selected_posts[]": window.postState
246+ };
247+ }
248+ else {
249+ grid.reloadParams = {
250+ "selected_posts[]": ["-1"]
251+ };
252+ }
239253 } ' ;
240254 }
241255
You can’t perform that action at this time.
0 commit comments