| @@ -140,9 +140,12 @@ | ||
| 140 | 140 | * |
| 141 | 141 | * @access public |
| 142 | 142 | * @return string The serialized array of data. |
| 143 | 143 | */ |
| 144 | - public function getData() { | |
| 144 | + public function getData( $fetch_from_editable_table = false ) { | |
| 145 | + if ( $fetch_from_editable_table ) { | |
| 146 | + $this->_fetchDataFromEditableTable(); | |
| 147 | + } | |
| 145 | 148 | return serialize( $this->_data ); |
| 146 | 149 | } |
| 147 | 150 | |
| 148 | 151 | /** |
| @@ -152,9 +155,12 @@ | ||
| 152 | 155 | * |
| 153 | 156 | * @access public |
| 154 | 157 | * @return array |
| 155 | 158 | */ |
| 156 | - public function getRawData() { | |
| 159 | + public function getRawData( $fetch_from_editable_table = false ) { | |
| 160 | + if ( $fetch_from_editable_table ) { | |
| 161 | + $this->_fetchDataFromEditableTable(); | |
| 162 | + } | |
| 157 | 163 | return $this->_data; |
| 158 | 164 | } |
| 159 | 165 | |
| 160 | 166 | /** |
| @@ -442,9 +448,8 @@ | ||
| 442 | 448 | * |
| 443 | 449 | * @access private |
| 444 | 450 | */ |
| 445 | 451 | private function _fetchDataFromEditableTable() { |
| 446 | - $params = $this->_args; | |
| 447 | 452 | $headers = wp_list_pluck( $this->_series, 'label' ); |
| 448 | 453 | $this->fetch(); |
| 449 | 454 | |
| 450 | 455 | $data = $this->_data; |
| @@ -451,9 +456,12 @@ | ||
| 451 | 456 | $this->_data = array(); |
| 452 | 457 | |
| 453 | 458 | foreach ( $data as $line ) { |
| 454 | 459 | $data_row = array(); |
| 455 | - foreach ( $line as $header => $value ) { | |
| 460 | + // we have to make sure we are fetching the data in the right order | |
| 461 | + // in case the columns have been reordered | |
| 462 | + foreach ( $headers as $header ) { | |
| 463 | + $value = $line[ $header ]; | |
| 456 | 464 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 457 | 465 | if ( in_array( $header, $headers ) ) { |
| 458 | 466 | $data_row[] = $value; |
| 459 | 467 | } |