Trace: • Global Metadata Caching
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
jvx:client:model:databook:record_iteration [2023/02/08 17:30] admin |
jvx:client:model:databook:record_iteration [2023/02/08 17:57] (current) admin |
||
---|---|---|---|
Line 2: | Line 2: | ||
~~Title: Record iteration~~ | ~~Title: Record iteration~~ | ||
- | It's possible to iterate all records of a databook by index, e.g. | + | It's possible to iterate all records of a databook with different techniques. It's a performance decission what's best. Just reading is fastest. |
- | Simply iterate with optional record change | + | You decide if you iterate for reading or for changing records. An iteration |
+ | |||
+ | ==Iterate with optional record change (Solution 1)== | ||
<file java> | <file java> | ||
int masterRow = mdbMaster.getSelectedRow(); | int masterRow = mdbMaster.getSelectedRow(); | ||
Line 37: | Line 39: | ||
</file> | </file> | ||
- | Simply iterate with record change: | + | ==Iterate with optional record change (Solution 2)== |
- | + | ||
- | <file java> | + | |
- | int masterRow = mdbMaster.getSelectedRow(); | + | |
- | int detailRow = mdbDetail.getSelectedRow(); | + | |
- | + | ||
- | try | + | |
- | { | + | |
- | for (int i = 0; i < mdbMaster.getRowCount(); i++) | + | |
- | { | + | |
- | mdbMaster.setSelectedRow(i); | + | |
- | + | ||
- | for (int j = 0; j < mdbDetail.getRowCount(j); j++) | + | |
- | { | + | |
- | mdbDetail.setSelectedRow(j); | + | |
- | } | + | |
- | } | + | |
- | } | + | |
- | finally | + | |
- | { | + | |
- | mdbMaster.setSelectedRow(masterRow); | + | |
- | mdbDetail.setSelectedRow(detailRow); | + | |
- | } | + | |
- | </file> | + | |
- | + | ||
- | Another solution for iteration with optional record change: | + | |
<file java> | <file java> | ||
Line 94: | Line 71: | ||
} | } | ||
} | } | ||
+ | </file> | ||
+ | |||
+ | ==Iterate with record change== | ||
+ | |||
+ | <file java> | ||
+ | int masterRow = mdbMaster.getSelectedRow(); | ||
+ | int detailRow = mdbDetail.getSelectedRow(); | ||
+ | |||
+ | try | ||
+ | { | ||
+ | for (int i = 0; i < mdbMaster.getRowCount(); i++) | ||
+ | { | ||
+ | mdbMaster.setSelectedRow(i); | ||
+ | | ||
+ | for (int j = 0; j < mdbDetail.getRowCount(j); j++) | ||
+ | { | ||
+ | mdbDetail.setSelectedRow(j); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | finally | ||
+ | { | ||
+ | mdbMaster.setSelectedRow(masterRow); | ||
+ | mdbDetail.setSelectedRow(detailRow); | ||
+ | } | ||
</file> | </file> |