[Turn] easyUI datagrid dynamically control and display hidden columns

Method a: {field: 'pictureId', title: ' whether poster', width: 70, align = left: "Center",
                                      // V the current field value, r row object, i is an index
                                      formatter: function (v, r, I) {
                                          IF (r.pictureId == null || r.pictureId == '') {
                                              $ ( '# gridspecialprogram'.) DataGrid ( 'also hideColumn', 'PictureID'); // PictureID: Filed value
                                          } else {
                                              . $ ( '# gridspecialprogram') datagrid ( 'showColumn', 'pictureId'); // gridspecialprogram: datagrid of the above mentioned id
                                              return r.pictureId;
                                          }
                                      }
                                  }

Method two: {field: 'pictureId', title: ' whether poster', width: 70, align = left: "Center",
                                      // V the current field value, r row object, i is an index
                                      formatter: function (v, r, I) {
                                          IF (r.pictureId == null || r.pictureId == '') {
                                              $ ( 'TD [Field = "PictureID"]') hide (); // PictureID:. Filed value
                                          } the else {
                                              $ ( 'td [field = "pictureId "]') show (); // gridspecialprogram:. datagrid the ID
                                              return r.pictureId;
                                          }
                                      }
                                  }
---------------------
Author: Cheng City, wind Choi
Source: CSDN
Original: https: //blog.csdn.net/world_the_begin/article/details/80326805

Guess you like

Origin www.cnblogs.com/tyrd/p/10972781.html