0
현재 환자로 채워지는 Telerik MVC Grid가 있습니다. 달성하고자하는 것은 행을 클릭 할 때마다 환자의 추가 세부 정보를 표시하는 툴팁이 표시됩니다.부분 뷰로 툴팁 삽입하기 - Telerik MVC 격자
그리드
<% Html.Telerik()
.Grid<Mvc2.ViewModels.PatientsGridViewModel>()
.Name("PatientsGrid")
.Columns(columns =>
{
columns.Bound(o => o.PatientId).ClientTemplate("<input class='gridcheck' type='checkbox' name='checkedRecords' value='<#=PatientId#>'/>").Width(30).Title("");
columns.Bound(o => o.PatientGuid).Title("Patient Id");
columns.Bound(o => o.PatientName).Title("Patient Name");
columns.Bound(o => o.DateOfBirth).Title("Date of Birth?");
columns.Bound(o => o.Sex).Title("Sex");
columns.Bound(o => o.Status).Title("Status");
columns.Bound(o => o.LastActivityDate).Title("Last Activity");
})
.DataBinding(dataBinding => dataBinding
.Ajax()
.Select("_AjaxBindingPatients", "Patients")
)
.Sortable()
.ClientEvents(events => events.OnDataBound("onDataBound").OnRowSelect("onRowSelect"))
.Pageable()
.Selectable()
.Render();
%>
행 클릭했습니다 이벤트 마지막
function onRowSelect(e) {
var row = e.row;
$.ajax({ type: "POST",
url: "/Patients/GetAdditionalPatientInformation",
datatype: "json",
traditional: true,
data:
{
'patientGuid': row.cells[1].innerHTML
}
});
}
와 환자를 반환 할 것 컨트롤러 액션을 ((도구 설명을 해고해야 할 것이다) patientGuid 사용)
[HttpPost]
public Patient GetAdditionalPatientInformation(string patientGuid)
{
Patient currentPatient = currentPatients.Where<Patient>(p => p.PatientGuid == Guid.Parse(patientGuid)).FirstOrDefault();
return currentPatient;
}
현재 - onRowSelect가 올바르게 실행되고 올바른 Patient를 가져 오는 컨트롤러를 호출합니다. 나는 이것을 구현하기 위해 사용하는 간단한 툴팁이나 다른 더 우아한 방법이 가능한지 알아 내려고 노력하고있다.
감사합니다. 정교함이 필요하다면 물어보십시오.