下面是包含折叠面板的表的代码.该click事件处理函数抛出的错误消息"m.apply不是一个函数".
Quux.CollapseExpandCustom.ToggleSection('+id+') 是接受动态id的函数.
请让我知道我犯的错误.我需要绑定click代码中提到的事件.
<table id="EditFooList">
<thead>
<tr>
<th>User</th>
<th>Started Date</th>
<th>Foo</th>
<th>Action</th>
</tr>
</thead>
<tbody data-bind="foreach: EditedDataArray">
<tr>
<td data-bind="text: $data.UserName"></td>
<td data-bind="text: $data.TimeStampString"></td>
<td>
<div>
<p data-bind="text: $data.Title, click: $root+'.'+'Quux.CollapseExpandCustom.ToggleSection('+$data.Baz+')'">Foos<img src="~/Images/Collapse.png" /></p>
<div>
<div data-bind="attr:{id: $data.Baz}">
<ul data-bind="foreach: $data.FooDetailViewModels">
<li>
<input type="button" data-bind="value: 'Resume - ' + $data.TimeDate,click: $root.ClickResume , attr:{fooStudyId:$data.FooStudyId}" />
<input type="button" data-bind="value: 'Plan - ' +$data.TimeDate, click: $root.ClickPlan , attr:{fooStudyId:$data.FooStudyId}" />
</li>
</ul>
</div>
</div>
</div>
</td>
<td>
<input type="button"value="New" data-bind="attr:{id: …Run Code Online (Sandbox Code Playgroud) 我已经修改了解决方案。我能够获得进度条,但进度条永远不会隐藏
这是创建具有相对布局的进度条的类
public class ProgressBarHandler {
private ProgressBar mProgressBar;
private Context mContext;
private View _baseView;
private View _hideView;
public ProgressBarHandler(Context context,View baseView, View hideView) {
mContext = context;
_baseView = baseView;
_hideView = hideView;
ViewGroup layout = (ViewGroup) _baseView;//((Activity) context).findViewById(android.R.id.content).getRootView();
mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
mProgressBar.setIndeterminate(true);
RelativeLayout.LayoutParams params = new
RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
RelativeLayout rl = new RelativeLayout(context);
rl.setGravity(Gravity.CENTER);
rl.addView(mProgressBar);
layout.addView(rl, params);
hide();
}
public void show() {
mProgressBar.setVisibility(View.VISIBLE);
_hideView.setVisibility(View.INVISIBLE);
}
public void hide() {
mProgressBar.setVisibility(View.INVISIBLE);
_hideView.setVisibility(View.VISIBLE);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的 …