EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: proffl on July 07, 2014, 09:00:16 PM



Title: how to get original value after formatter?
Post by: proffl on July 07, 2014, 09:00:16 PM
 :)
if i use $('#pg').propertygrid('getRows')[1].Value it will get value of <span class=' value' ></span> instead of  value.
how to fix the problem?

 ??? ??? ??? ???


Title: Re: how to get original value after formatter?
Post by: jarry on July 08, 2014, 12:05:30 AM
The 'getRows' method of propertygrid is inherited from datagrid. It do return the original rows bound to the propertygrid. Please check your propertygrid data carefully.


Title: Re: how to get original value after formatter?
Post by: proffl on July 08, 2014, 04:46:30 AM
The 'getRows' method of propertygrid is inherited from datagrid. It do return the original rows bound to the propertygrid. Please check your propertygrid data carefully.

yes, that's because i've override getValue function. but what can i do if i wanna add formatter to one of my propertygrid row?
here is my json:
Code:
string json = "{\"total\":6,\"rows\":[";
            json += "{\"name\":\"ID \",\"value\":\"" + ID + "\"}";
            json += ",{\"name\":\"Name \",\"value\":\"" + Name + "\",\"editor\":{\"type\":\"validatebox\", \"options\":{\"required\":\"true\"}}}";
            json += ",{\"name\":\"Url \",\"value\":\"" + Url + "\",\"editor\":\"text\"}";
            json += ",{\"name\":\"Icon \",\"value\":\"" + Icon + "\",\"editor\":{\"type\":\"cbcIcon\",\"options\":{\"valueField\":\"id\",\"textField\":\"name\",\"url\":\"/Icon.aspx\",\"groupField\":\"group\"}}}";
and my javacript code in page:
Code:
$(document).ready(function () {
            $('#pg').propertygrid({
                url: '/Admin/MenuAdd.aspx?action=sg&id=<%=oldId%>',
                method: 'get',
                columns: [[{ field: "name", title: "名称", width: 100 }, { field: "value", title: "值", width: 150 }]]
            });
        });
i've tried some code like below:
Code:
$(document).ready(function () {
            $('#pg').propertygrid({
                url: '/Admin/MenuAdd.aspx?action=sg&id=<%=oldId%>',
                method: 'get',
                columns: [[{ field: "name", title: "名称", width: 100 }, { field: "value", title: "值", width: 150 }]],
                onLoadSuccess: function(data) {
                    $('#pg').propertygrid('getRows')[3].formatter = function(value) {
                              return '<span class="'+value+'">&nbsp;</span>';
                     }
                }
            });

        });
but it doesn't work~~~ :'( :'( :'(