posts - 431,  comments - 344,  trackbacks - 0
 

之前修改后者往Matrix添加一行记录的时候,都是用
jsx3.xml.Entity insertRecord(objRecord : Object<String, String>, strParentRecordId : String, bRedraw : boolean)
或者void insertRecordNode(objRecordNode : jsx3.xml.Entity, strParentRecordId : String, bRedraw : boolean)方法。
通过对两个方法的参数或者对insertRecordNode方法的说明:Inserts a new record into the XML data source of this object. This method is the same as insertRecord() except that its first parameter is of type jsx3.xml.Entity rather than Object.可以看出只是一个是对象,而后者则是一个Entity 。而这两种方法的最后一个参数也有说明:bRedraw – if true or null, the on-screen view of this object is immediately updated to reflect the additional record.
但这时候遇到了一个就是更新单元格的数据,而之前我们做的时候都是通过jsx3.xml.Entity getRecordNode(strRecordId : String)方法把当前选上的记录先获取到。然后再通过jsx3.xml.Entity setAttribute(strName : String, strValue : String)方法设置单元值。最后还要利用void repaintData()方法刷新数据。这样才可以把修改后的值显示出来。其中对repaintData解释是:Paints only the data rows. Call for quick repainting of the data rows when only the source data has changed. Does not recalculate and reprofile the box profile and resulting XSLT. Retains scroll position when possible.

而最近看到了另一个方法:jsx3.xml.CDF insertRecordProperty(strRecordId : String, strPropName : String, strPropValue : String, bRedraw : boolean);而这方法正好解决了单元格值的变化,Inserts a new property into an existing record with jsxid equal to strRecordId. If the property already exists, the existing property value will be updated. If no such record exists in the XML document, this method fails quietly.

另注:获取单行记录还有另一个方法:Object<String, String> getRecord(strRecordId : String);他与getRecordNode返回的类型不同,他返回的是对象。我们可以通过说明:Returns an object containing the attributes of a particular CDF record as property/value pairs. The object returned by this method is a copy of the underlying data. Therefore, updates to this object will not affect the underlying data.看出。他是一个克隆,也就是对其操作并不影响jsx3.xml.CDF里面的值。而当修改getRecordNode返回的Entity将会影响到jsx3.xml.CDFgetRecordNode的说明中就可以体现这一点。Returns a record from the XML data source of this object. This returned value is a handle to the record and not a clone. Therefore, any updates made to the returned value with update the XML document of this object. To reflect such changes in the on-screen view of this object, call redrawRecord(strRecordId, jsx3.xml.CDF.UPDATE); on this object.这里还说到了另一个方法redrawRecord(strRecordId, jsx3.xml.CDF.UPDATE); 这就相当与单行刷新。当然比使用void repaintData()方法刷新数据好的多了。
当然还有别的方法。例如Matrix里面还有一个实现就是:void redrawCell(strRecordId : String, objColumn : jsx3.gui.Matrix.Column, bSuppressTriggers : boolean)Updates the on-screen cell to reflect the value in the CDF document to which the cell is mapped.void redrawMappedCells(strRecordId : String, strAttName : String)Updates the on-screen cell to reflect the value in the CDF document to which the cell is mapped.以及对void redrawRecord(strRecordId : String, intAction : int, bRecurse : boolean)的实现。
所以当修改单行的单元格数据的时候看个人爱好了。

posted on 2007-05-24 20:44 周锐 阅读(313) 评论(0)  编辑  收藏 所属分类: TIBCO

只有注册用户登录后才能发表评论。


网站导航: