Home > Backend Development > C#.Net Tutorial > EasyUI——DataGrid's onClickRow event

EasyUI——DataGrid's onClickRow event

黄舟
Release: 2017-02-23 10:06:30
Original
1720 people have browsed it

When working on the teaching evaluation subsystem of the university cloud platform system, the student side has the function of clicking a hyperlink to jump and transfer the value to the specified interface. The implementation of hyperlinks is not complicated, but considering the user-friendly design for students to operate, the hyperlinks were changed to stand-alone and the effect of clicking the hyperlink anywhere in the row can be achieved, that is, the hyperlink can be jumped to the specified interface and uploaded. value.

By looking at the help documentation, I found the onClickRow event, which is triggered when the user clicks a row. The parameters include:

rowIndex: the clicked row The index value starts from 0.

rowData: The record corresponding to the clicked row.

We can get the value we want to pass through rowData, and then jump the page to the specified link. The js code is as follows:

<span style="font-family:KaiTi_GB2312;font-size:18px;">        <script type="text/javascript" >     
            $("#dg").datagrid({  
                onClickRow: function (index, row) {  //easyui封装好的时间(被单机行的索引,被单击行的值)

                    //需要传递的值
                    var CourseName = row["CourseName"];
                    var TeacherCourseID = row["TeacherCourseID"];
                    var AssessStatus = row["AssessStatus"];
                    if (AssessStatus=="尚未评估") //如果该项尚未评估,则支持跳转到评估页面
                    {
                        var url = "../EvaluationStudentAssess/StudentAssess?CourseName=" + CourseName + "&TeacherCourseID=" + TeacherCourseID
                    }
                    else {  //如果该项以经评估则不需要跳转
                        var url = "../EvaluationStudentAssess/AssessStatus"
                    }
                   
                    //通过Ajax传值
                    $.ajax({
                        url: url,
                        type: &#39;POST&#39;,
                        timeout: 100,

                        Error: function () {
                            alert(Error);
                        },
                        success: function () {
                            window.location.href = url
                        }
                    });    
                }
            });
        </script></span>
Copy after login

In fact, it is not complicated to implement. In many cases, if we take more tests, we can bring permanent simple operations to users. Serving the people wholeheartedly is what every programmer should uphold. The purpose of the trip.

Of course, there is more than one way to achieve it. The above is the method I personally thought of. If there are any shortcomings, please criticize and correct me. If you have other methods, please feel free to communicate.

The above is the content of EasyUI-DataGrid's onClickRow event. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template