05-08-2017, 01:58 PM
同一のRecordSetを、current-indexをずらして複数のRecordFormで参照し、
UIで変更した後に各RecordFormの変更内容を一括でRecordSetに反映したいです。
単一項目の変更であれば全てのレコードの変更内容が反映されるのですが、
複数項目を変更してupdateすると、
2つ目以降のRecordFormのcurrent-indexが0に変わり適切にupdateできません。
何か良い回避策はありますでしょうか。
※各RecordFormはナビゲーションパネルを非表示にしてindexをずらすため、
変更内容は行単位で競合しない作りを想定しております。
UIで変更した後に各RecordFormの変更内容を一括でRecordSetに反映したいです。
単一項目の変更であれば全てのレコードの変更内容が反映されるのですが、
複数項目を変更してupdateすると、
2つ目以降のRecordFormのcurrent-indexが0に変わり適切にupdateできません。
何か良い回避策はありますでしょうか。
※各RecordFormはナビゲーションパネルを非表示にしてindexをずらすため、
変更内容は行単位で競合しない作りを想定しております。
Code:
{curl 8.0 applet}
{curl-file-attributes character-encoding = "shift-jis"}
{def test-data =
{RecordSet
{RecordFields
{RecordField "tf1", domain = String},
{RecordField "tf2", domain = String}
},
{RecordData tf1 = "TextField11", tf2 = "TextField12"},
{RecordData tf1 = "TextField21", tf2 = "TextField22"}
}
}
{def rf1 =
{RecordForm
record-source = test-data,
display-navigation-panel? = true,
{HBox
{TextField {bind value to "tf1"}},
{TextField {bind value to "tf2"}}
}
}
}
{set rf1.current-index = 0}
{def rf2 =
{RecordForm
record-source = test-data,
display-navigation-panel? = true,
{HBox
{TextField {bind value to "tf1"}},
{TextField {bind value to "tf2"}}
}
}
}
{set rf2.current-index = 1}
{View
{VBox
{CommandButton
label = "update",
width = 300px,
{on Action do
{rf1.update}
{rf2.update}
}
},
rf1,
rf2
},
visibility = "normal",
{on WindowClose do
{exit}
}
}