Data is a multi-dimensional array:
1. If data filtering is performed on the M (or C) layer, it is convenient for the V layer to display data, but M and V need to perform an array traversal respectively.
2. If the filtering is placed directly on the V layer, only one array traversal is needed, but it conflicts with MVC and is inconvenient for front-end processing.
How did everyone deal with it?
(In fact, this problem also exists in non-MVC mode, but it is easier to understand with MVC)
習慣沉默2017-05-16 17:08:40
If display and logic are separated... then only two array traversals can be done... There is no way...
Small processing of data such as truncation, etc. can be completed at the V layer...but filtering must be completed at the M layer...
This is a matter of collaboration... It is normal to sacrifice a little efficiency...