[QGIS-Developer] reload attribute table does not work for attribute changed by dataProvider

Zhang Qun zhangq.rhy at gmail.com
Wed Jun 13 02:18:21 PDT 2018


Hi everyone, i"m using QGIS2.18, and trying to change feature attributes
using the following two methods:

*dataProvider:*

attrs = { 0 : "hello", 1 : 123 }
layer.dataProvider().changeAttributeValues({ fid : attrs })

*layer object:*

layer.startEditing()
layer.changeAttributeValue(fid, fieldIndex, value)
layer.commitChanges()

I keep the attribute table open, and monitor the changes. The first method
dataProvider is not able to update the attribute table on the fly, even the
"reload table" button on the top menu of the table does not work. I have to
re-open the table to see the changes. The second method is working, the
attribute table gets instantly updated.

I would like to stay with the dataProvider method but not sure how to get
instantly updated attribute table?
Thanks.

Best regards,
Ethan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180613/5db99a97/attachment.html>


More information about the QGIS-Developer mailing list