Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"Result" : [
- {
- "Id" : "5214",
- "ParentReasonId" : "0",
- "Description" : "Billing & Payment",
- "SysName" : "Billing & Payment",
- "SysCategory" : "Billing & Payment",
- "ClientId" : "924",
- "DispositionCount" : "6",
- "IsActive" : true,
- "ChildReasonCount" : "8",
- "Attributes" : [],
- "SortOrder" : "0",
- "CreatedBy" : null
- }
- ]
- }
- jQuery("#chained_child").cascade("#chained", {
- ajax: { url: 'Customhandler.ashx?List=MyList' },
- template: commonTemplate,
- match: commonMatch
- });
- function commonTemplate(item) {
- return "<option Value='" + item.Result.Id + "'>"
- + item.Result.Description + "</option>";
- };
- item.Result[0].Id
- {
- "Result" :
- {
- "Id" : "5214",
- "ParentReasonId" : "0",
- "Description" : "Billing & Payment",
- "SysName" : "Billing & Payment",
- "SysCategory" : "Billing & Payment",
- "ClientId" : "924",
- "DispositionCount" : "6",
- "IsActive" : true,
- "ChildReasonCount" : "8",
- "Attributes" : [],
- "SortOrder" : "0",
- "CreatedBy" : null
- }
- }
- [
- {
- "Result" :
- {
- "Id" : "5214",
- "ParentReasonId" : "0",
- "Description" : "Billing & Payment",
- "SysName" : "Billing & Payment",
- "SysCategory" : "Billing & Payment",
- "ClientId" : "924",
- "DispositionCount" : "6",
- "IsActive" : true,
- "ChildReasonCount" : "8",
- "Attributes" : [],
- "SortOrder" : "0",
- "CreatedBy" : null
- }
- }
- ]
- $(function(){
- $('#chained_child').cascade(
- '#chained',
- {
- ajax: {
- url: 'Customhandler.ashx?List=MyList',
- dataFilter: extractResult
- },
- template: customTemplate,
- match: customMatch
- }
- );
- function extractResult(data) {
- return eval('(' + data + ')').Result;
- }
- function customTemplate(item) {
- return $('<option />')
- .val(item.Id)
- .text(item.Description);
- }
- function customMatch(selectedValue) {
- return this.ParentReasonId == selectedValue;
- }
- });
Add Comment
Please, Sign In to add comment