Apache flex Flash Builder:如何刷新datagrid数据?
我正在尝试刷新datagrid,以反映用户更新数据库后更新的数据。可能吗?我有以下代码: 剧本Apache flex Flash Builder:如何刷新datagrid数据?,apache-flex,datagrid,flash-builder,Apache Flex,Datagrid,Flash Builder,我正在尝试刷新datagrid,以反映用户更新数据库后更新的数据。可能吗?我有以下代码: 剧本 protected function updataHandler(event:MouseEvent):void { updateJobsResult.token = Service.updateJobs(updateJobData); //The database will be updated after users click the update button //I want
protected function updataHandler(event:MouseEvent):void
{
updateJobsResult.token = Service.updateJobs(updateJobData);
//The database will be updated after users click the update button
//I want to update datagrid dataprovider to show the updated data.
}
<s:datagrid dataprovider="jobdata">
//jobdata comes from from database query
..................
..................
</datagrid>
<s:form>
//when user selects the row in datagrid, the cell values will
//pop in this form and user can update the form
.................
.................
</form>
<s:button click="updateHandler">
谢谢你的帮助 最简单的方法是在服务成功响应时刷新dataProvider jobdata。如果服务器抛出错误,您不想在更新视图之前更新它。如果您用[Bindable]标记它,datagrid将立即自动更新
如果愿意使用唯一标识符(如果可用),也可以直接替换数据提供程序中的单个项。有两种方法: 更新数据库后,可以再次检索数据并 将其分配给数据提供程序 向数据库发送更新请求时,还可以直接更新数据提供程序