设置“属性”;在验证器上
我在数据网格列中的每个单元格上使用 NumberValidator。源设置为数据网格的 dataProvider 但属性是问题。我不能只说“文本”,因为我使用 labelFunction 来检索属性,因为它嵌套在另一个对象内。
有办法解决这个问题吗?我需要创建自己的自定义验证器吗?我希望不会。任何提示表示赞赏。
谢谢!
<mx:NumberValidator
source="{this.secId_dg.dataProvider}" lowerThanMinError="A locate is required."
property="marketRule.locRule.locRuleId" minValue="0" />
<mx:DataGrid
editable="true"
width="100%"
rowCount="10"
tabEnabled="false">
<mx:columns>
<mx:DataGridColumn
editorDataField="text"
editable="true">
<mx:itemEditor>
<mx:Component>
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
<mx:DataGridColumn
headerText="Description"
dataField="description"
width="200"
editable="false"/>
<mx:DataGridColumn
headerText="Locate"
headerStyleName="leftGridHeader"
paddingRight="4"
textAlign="right"
labelFunction="getLocate"
editable="true"
dataField="locRuleDesc"
editorDataField="selectedLabel"
/>
<mx:DataGridColumn
headerText="Comments"
width="200"
editable="true"/>
<mx:DataGridColumn
headerText="Delete"
editable="false"
DeleteIconRenderer"/>
</mx:columns>
</mx:DataGrid>
I'm using a NumberValidator on each cell in a column on a datagrid. The source is set to the datagrid's dataProvider but the property is the problem. I can't just say 'text' because I use a labelFunction to retrieve the property because it's nested inside another object.
Any way to get around this? Am I going to need to create my own custom validator? I hope not. Any tips are appreciated.
Thanks!
<mx:NumberValidator
source="{this.secId_dg.dataProvider}" lowerThanMinError="A locate is required."
property="marketRule.locRule.locRuleId" minValue="0" />
<mx:DataGrid
editable="true"
width="100%"
rowCount="10"
tabEnabled="false">
<mx:columns>
<mx:DataGridColumn
editorDataField="text"
editable="true">
<mx:itemEditor>
<mx:Component>
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
<mx:DataGridColumn
headerText="Description"
dataField="description"
width="200"
editable="false"/>
<mx:DataGridColumn
headerText="Locate"
headerStyleName="leftGridHeader"
paddingRight="4"
textAlign="right"
labelFunction="getLocate"
editable="true"
dataField="locRuleDesc"
editorDataField="selectedLabel"
/>
<mx:DataGridColumn
headerText="Comments"
width="200"
editable="true"/>
<mx:DataGridColumn
headerText="Delete"
editable="false"
DeleteIconRenderer"/>
</mx:columns>
</mx:DataGrid>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的解决方案是使用
source
和property
值的正确组合。你走在正确的轨道上。对于
source
属性,文档是这样说的:因此,在您的情况下,您可能希望使您的
source
属性字符串更长一些,以深入到包含要验证的属性的项目中。也许:那么您要验证的属性将是:
The solution here is to use the proper combination of
source
andproperty
values. You were on the right track.For the
source
property the documentation says this:So in your case, you would have wanted to make your
source
property string a bit longer, something that reached down into the item that contained the property to validate. Perhaps:Then your property to validate would simply be: