1

我这里有点问题。我使用 Delphi XE2 DataSnap 技术在我的应用程序服务器中创建了一个查找字段。在客户端,该字段变为 TStringField。现在,问题是我失去了客户端的查找功能。最重要的是,我无法更改客户端的字符串字段,因为它是只读的(即使我手动关闭了只读属性)。

我不想在客户端查找表,因为我不希望在客户端加载所有数据只是为了支持查找。

我可以更改键字段值,但字符串字段查找文本不会更改,除非我应用更新并重新加载数据。

用户希望看到文本更改。

我应该怎么办?

4

2 回答 2

0

似乎您必须检查您的 GUI 功能:查找字段实际上是客户端功能。它需要查找源——因此要在客户端使用它,必须加载查找表。DataSnap 的人在这里非常好,将其传输到客户端时将其转换为 TStringField ......我会简单地忽略它。

因此,如果查找表那么大,则不应使用查找字段,而应使用搜索 UI 或自动完成组合框,以便对 DataSnap 服务器进行查询。也许你必须在组合框的情况下手动编码,我不知道(看看 JVCL 是否有一些你可以用来缩短路径的东西)。

或者,如果查找表很少更新,您可以积极缓存它并使用更新机制来检测更改。因此,您可以按照创建它们的方式使用查找字段。

于 2012-02-02T19:10:48.380 回答
0

Long time ago i faced that problem and i found a solution that is a bit complex to analyze here but i try to give some guidelines till i have the time to write a detailed blog post. The idea consists of info (concerning lookup fields such as field properties, datasets, providers) packaged by the provider as optionalparams at the server side. At client side a derived TClientDataset can unpack and process these info, create on the fly client datasets that retrieve needed lookup datasets and setup it's lookup fields accordingly. The process is transparent due to the embedded functionality in the derived client dataset class and the only things to remember is to create that info in the provider's OnGetDatasetProperties event and turn false all provider flags in lookup fields.

于 2012-02-10T11:48:39.943 回答