我的dataview
有一列名为RecordType
(SQL中的主键,类型为varchar(18)
),其中有3条记录{“NH”,“NTH”,“XH”}。
现在,我希望通过编码来过滤以“N”开头的数据:
( myDataView.RowFilter = "RecordType LIKE 'N*'")
,但只返回了1条记录({“NTH”})
确切结果必须有2条记录({“NH”,“NTH”})。
请问我该怎么纠正?
答案 0 :(得分:0)
我已经尝试过它并且有效:
myDataView.RowFilter = "RecordType LIKE 'N*'";
它将返回" NH"和" NTH"。
答案 1 :(得分:0)
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("idcell", forIndexPath: indexPath) as UITableViewCell
let lblTitle : UILabel = cell.contentView.viewWithTag(101) as! UILabel
lblTitle.text = (deptId[indexPath.row] as? String)! + " " + (deptDesc[indexPath.row] as? String)!
var height:CGFloat = 0
cell.backgroundColor = UIColor.whiteColor()
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
if(indexPath == selectedIndexPath){
cell.backgroundColor = UIColor.grayColor()
for i in 0...deptProfile.count-1{
let deptmentProfile = UIButton(frame: CGRectMake(0,44+height,400,41))
deptmentProfile.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside)
height = height+41
deptmentProfile.setTitle(deptProfile[i] as! String, forState: UIControlState.Normal)
deptmentProfile.setTitleColor(UIColor.blackColor(), forState: .Normal)
deptmentProfile.contentHorizontalAlignment = UIControlContentHorizontalAlignment.Left
deptmentProfile.backgroundColor = UIColor.whiteColor()
deptmentProfile.titleEdgeInsets = UIEdgeInsetsMake(0, 40, 0, 0); //margin to the left
cell.addSubview(deptmentProfile)
}
cell.accessoryType = UITableViewCellAccessoryType.None
}
return cell
}
非常感谢大家的时间。我发现,当我们设置系统的CurrentCulture时,它会影响数据视图的过滤和排序。
要解决此问题,我们必须按默认值再次分配dataview的位置:
myDataView.Table.Locale = new CultureInfo(" en-US");
我是这么认为的。还有其他好主意吗?