0

LeaveTypeName と id を持つ json があります。id だけを持つ別の json があります。2 番目の json の指定された ID に LeavetypeName を取得するにはどうすればよいですか?表示されます!助けてください

ID と LeavetypeName を持つ最初の json

 {
        "LeaveTypes": [
            {
                "ID": 60,
                "LeavetypeName": "Casual Leave"
            },
            {
                "ID": 61,
                "LeavetypeName": "Sick Leave"
            },
            {
                "ID": 62,
                "LeavetypeName": "Privilege Leave"
            },
            {
                "ID": 63,
                "LeavetypeName": "Maternity Leave"
            },
            {
                "ID": 64,
                "LeavetypeName": "Hospitalization Leave"
            },
            {
                "ID": 65,
                "LeavetypeName": "Bereavement Leave"
            },
            {
                "ID": 66,
                "LeavetypeName": "Medical Leave"
            },
            {
                "ID": 67,
                "LeavetypeName": "Paternity Leave"
            },
            {
                "ID": 68,
                "LeavetypeName": "Compensatory Leave"
            },
            {
                "ID": 69,
                "LeavetypeName": "Loss of Pay Leave"
            }
        ]
    }

2番目のjson.itには、Leavetypenameをディスプレイに表示する代わりに、LeaveTypeIdがあります。

[
    {
        "ID": 37,
        "LeaveEligibility": [
            {
                "Availed": 4,
                "Fullpaydays": 6,
                "Halfpaydays": 0,
                "ID": 1,
                "LeaveTypeId": 60,
                "PersonId": 37,
                "YearOfLeave": 2013
            },
            {
                "Availed": 2,
                "Fullpaydays": 6,
                "Halfpaydays": 0,
                "ID": 3,
                "LeaveTypeId": 61,
                "PersonId": 37,
                "YearOfLeave": 2013
            },
            {
                "Availed": 10,
                "Fullpaydays": 10,
                "Halfpaydays": 0,
                "ID": 4,
                "LeaveTypeId": 62,
                "PersonId": 37,
                "YearOfLeave": 2013
            },
            {
                "Availed": 0,
                "Fullpaydays": 8,
                "Halfpaydays": 0,
                "ID": 6,
                "LeaveTypeId": 63,
                "PersonId": 37,
                "YearOfLeave": 2013
            }
        ],
        "LeaveHistory": [
            {
                "AppliedTo": "Vibha",
                "ApprovalDate": "3/12/2013 12:00:00 AM",
                "ApprovedBy": 12,
                "Duration": 3,
                "FromDate": "3/24/2013 12:00:00 AM",
                "FullPayDays": 3,
                "HalfPayDays": 0,
                "ID": 1,
                "LeaveTypeId": 60,
                "LossOfPayDays": 0,
                "PersonId": 37,
                "Remarks": "onnulla",
                "StatusId": 79,
                "SubstitutePersonId": 13,
                "ToDate": "3/26/2013 12:00:00 AM"
            },
            {
                "AppliedTo": "Vibha",
                "ApprovalDate": "3/12/2013 12:00:00 AM",
                "ApprovedBy": 12,
                "Duration": 1,
                "FromDate": "3/30/2013 12:00:00 AM",
                "FullPayDays": 1,
                "HalfPayDays": 0,
                "ID": 2,
                "LeaveTypeId": 60,
                "LossOfPayDays": 0,
                "PersonId": 37,
                "Remarks": "onnulla",
                "StatusId": 79,
                "SubstitutePersonId": 13,
                "ToDate": "3/31/2013 12:00:00 AM"
            },
            {
                "AppliedTo": "Shyam",
                "ApprovalDate": "",
                "ApprovedBy": 0,
                "Duration": 2,
                "FromDate": "2/13/2013 12:00:00 AM",
                "FullPayDays": 2,
                "HalfPayDays": 0,
                "ID": 4,
                "LeaveTypeId": 61,
                "LossOfPayDays": 0,
                "PersonId": 37,
                "Remarks": "blha blah",
                "StatusId": 70,
                "SubstitutePersonId": 1,
                "ToDate": "2/14/2013 12:00:00 AM"
            },
            {
                "AppliedTo": "Shyam",
                "ApprovalDate": "2/13/2013 4:35:16 PM",
                "ApprovedBy": 2,
                "Duration": 5,
                "FromDate": "3/23/2013 12:00:00 AM",
                "FullPayDays": 5,
                "HalfPayDays": 0,
                "ID": 5,
                "LeaveTypeId": 62,
                "LossOfPayDays": 0,
                "PersonId": 37,
                "Remarks": "oh..",
                "StatusId": 71,
                "SubstitutePersonId": 1,
                "ToDate": "3/27/2013 12:00:00 AM"
            },
            {
                "AppliedTo": "Shyam",
                "ApprovalDate": "2/13/2013 4:35:16 PM",
                "ApprovedBy": 2,
                "Duration": 5,
                "FromDate": "3/28/2013 12:00:00 AM",
                "FullPayDays": 5,
                "HalfPayDays": 0,
                "ID": 6,
                "LeaveTypeId": 62,
                "LossOfPayDays": 0,
                "PersonId": 37,
                "Remarks": "oh..",
                "StatusId": 71,
                "SubstitutePersonId": 1,
                "ToDate": "3/29/2013 12:00:00 AM"
            }
        ],
        "PLavailedcount": 2
    }
]
4

1 に答える 1

0

あなたは試しましたか:

Ext.data.JsonStore.findRecord( fieldName, value, [startIndex], [anyMatch], [caseSensitive], [exactMatch] ) : Ext.data.Model

ドキュメンテーションはこちら

?

于 2013-03-26T14:04:36.577 に答える