我有一个复选框项P50_SELECT。如何在PL / SQL中获取P50_SELECT的已检查值列表?
答案 0 :(得分:0)
您可以在下面使用,var将包含选中的值。项目本身存储值,而不是所有选项。这不是一个列表,它将是逗号或冒号分隔的字符串。
public class NavDrawerExpandableListAdapter extends BaseExpandableListAdapter {
private static final int CHILD_HEADER = 0;
private static final int CHILD_LINE_ITEM = 1;
private Context context;
private List<String> expandableListTitle;
private HashMap<String, List<String>> expandableListDetail;
private final Set<Pair<Long, Long>> mToggleSwitchedItems = new HashSet<Pair<Long, Long>>();
public NavDrawerExpandableListAdapter(Context context, List<String> expandableListTitle,
HashMap<String, List<String>> expandableListDetail) {
this.context = context;
this.expandableListTitle = expandableListTitle;
this.expandableListDetail = expandableListDetail;
}
//set the toggle switch state of the child header so we can access it in other layouts
private void setChildToggleCheckedState(boolean state) {
this.childToggleHeaderState = state;
}
//get the toggle switch state of the child header toggle so we can access it in other layouts
public boolean getChildToggleCheckedState() {
return childToggleHeaderState;
}
//view holder class to store our textView
private class ViewHolder {
TextView textView;
Switch childHeaderToggle;
}
//number of different types of views we're gonna inflate for the children
@Override
public int getChildTypeCount () {
return 2;
}
//specify which viewType to inflate in the getView method
@Override
public int getChildType (int groupPosition, int childPosition) {
switch(childPosition) {
case 0:
return CHILD_HEADER;
default:
return CHILD_LINE_ITEM;
}
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return this.expandableListDetail.get(this.expandableListTitle.get(groupPosition))
.get(childPosition);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
//declare our view and viewholder objects
View view = convertView;
ViewHolder viewHolder;
String expandedListText;
//define childType
int childType = getChildType(groupPosition, childPosition);
//define the toggleTag position
Pair<Long, Long> childHeaderToggleTag = new Pair<Long, Long>(getGroupId(groupPosition), getChildId(groupPosition, childPosition));
if (convertView == null) {
viewHolder = new ViewHolder();
switch (childType) {
case CHILD_HEADER:
//inflate our layout and textview then setTag viewholder if the view is null
view = LayoutInflater.from(context).inflate(R.layout.navdrawer_list_item_header, null);
viewHolder.textView = (TextView) view.findViewById(R.id.expandedListItemChildHeader);
viewHolder.childHeaderToggle = (Switch) view.findViewById(R.id.toggle_allDevices);
break;
case CHILD_LINE_ITEM:
expandedListText = (String) getChild(groupPosition, childPosition - 1);
//inflate our layout and textview then setTag viewholder if the view is null
view = LayoutInflater.from(context).inflate(R.layout.navdrawer_list_item, null);
viewHolder.textView = (TextView) view.findViewById(R.id.expandedListItem);
viewHolder.textView.setText(expandedListText);
break;
default:
expandedListText = (String) getChild(groupPosition, childPosition - 1);
//inflate our layout and textview then setTag viewholder if the view is null
view = LayoutInflater.from(context).inflate(R.layout.navdrawer_list_item, null);
viewHolder.textView = (TextView) view.findViewById(R.id.expandedListItem);
viewHolder.textView.setText(expandedListText);
break;
}
view.setTag(viewHolder);
}
else {
//otherwise if the view exists then gettag() our saved view
viewHolder = (ViewHolder) view.getTag();
}
//control the state of the child header toggle switch
if (childPosition == 0) {
viewHolder.childHeaderToggle.setTag(childHeaderToggleTag);
// set switched on if groupId/childId is in switched list
viewHolder.childHeaderToggle.setChecked(mToggleSwitchedItems.contains(childHeaderToggleTag));
setChildToggleCheckedState(mToggleSwitchedItems.contains(childHeaderToggleTag));
//depending on toggle state set our child header text colors
if (!getChildToggleCheckedState()) {
viewHolder.textView.setTextColor(ContextCompat.getColor(context, R.color.navDrawerInactiveText));
}
else {
viewHolder.textView.setTextColor(ContextCompat.getColor(context, R.color.navDrawerDisabledText));
}
// set OnClickListener to handle checked switches
viewHolder.childHeaderToggle.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final Switch cb = (Switch) v;
final Pair<Long, Long> tag = (Pair<Long, Long>) v.getTag();
if (cb.isChecked()) {
setChildToggleCheckedState(true);
mToggleSwitchedItems.add(tag);
} else {
setChildToggleCheckedState(false);
mToggleSwitchedItems.remove(tag);
}
//update our list when switch toggled
notifyDataSetChanged();
}
});
//set the text for our child header here
viewHolder.textView.setText("All Teams");
}
else {
//depending on toggle state set our remaining text colors
if (!getChildToggleCheckedState()) {
viewHolder.textView.setTextColor(ContextCompat.getColor(context, R.color.navDrawerInactiveText));
}
else {
viewHolder.textView.setTextColor(ContextCompat.getColor(context, R.color.navDrawerDisabledText));
}
//set our text for all remaining children
expandedListText = (String) getChild(groupPosition, childPosition - 1);
viewHolder.textView.setText(expandedListText);
}
return view;
}
@Override
public int getChildrenCount(int listPosition) {
return (this.expandableListDetail.get(this.expandableListTitle.get(listPosition))
.size() + 1);
}
@Override
public Object getGroup(int listPosition) {
return this.expandableListTitle.get(listPosition);
}
@Override
public int getGroupCount() {
return this.expandableListTitle.size();
}
@Override
public long getGroupId(int listPosition) {
return listPosition;
}
@Override
public View getGroupView(int listPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String listTitle = (String) getGroup(listPosition);
if (convertView == null) {
LayoutInflater layoutInflater = (LayoutInflater) this.context.
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = layoutInflater.inflate(R.layout.navdrawer_list_group, null);
}
TextView listTitleTextView = (TextView) convertView
.findViewById(R.id.listTitle);
listTitleTextView.setTypeface(null, Typeface.BOLD);
listTitleTextView.setText(listTitle);
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int listPosition, int expandedListPosition) {
return true;
}
答案 1 :(得分:0)
在PL / SQL中,您可以通过:P50_SELECT
(或v('P50_SELECT')
)访问它们。它将是一个以冒号分隔的列表,仅包含已检查项的值。您可以先使用apex_util.string_to_table(:P50_SELECT)