使用内部数组中的值对外部数组进行排序

时间:2017-11-17 14:40:27

标签: javascript arrays sorting

昨天我遇到了一个问题Returning data after sorting through multiple arrays,从嵌套数组中排序数据。我设法解决了这个问题。

clientRef

我需要使用内部排序数组,它按顺序命令[ 0: { transRef: "IX1000013" renewalProgress: 30 renewalUIs: [ 0: { patentUI: { business: null clientRef: P0101011 // this is the required value } renewalAttemptsMade: 1 renewalDueDate: 1514764740000 } ] }, 1: { transRef: "IX100333" renewalProgress: 55 renewalUIs: [ 0: { patentUI: { business: null clientRef: P0101011 // this is the required value } renewalAttemptsMade: 1 renewalDueDate: 1514764740000 }, 1: { patentUI: { business: null clientRef: P5551011 // this is the required value } renewalAttemptsMade: 3 renewalDueDate: 174834740000 } ] } ] 来排序外部数组。

问题

我将如何根据内部数组的顺序对外部光线进行排序?

clientRef

orderedData输出。只需要patentUI对象中的0:null clientRef:"P100535EP02" costBandColour:"Blue" costBandEndDate:1524006000071 costBandEndDateUI:"Wed Apr 18, 2018" currentRenewalCost:2659.07 currentRenewalCostUSD:2659.07 epoPatentStatus:"EXAMINATION IN PROGRESS" feeUI:{renewalFeeEUR: 1395, extensionFeeEUR: 697.5, renewalFeeUSD: 1759.374, extensionFeeUSD: 879.687, processingFeeUSD: 20, …} filingDate:1255388400000 filingDateUI:"Tue Oct 13, 2009" id:1 title: "WONDER FABRIC" 1:{patentApplicationNumber: "EP17169508", title: "REAL-TIME ADJUSTABLE WINDOW FEATURE FOR BARCODE SC…F SCANNING BARCODE WITH ADJUSTABLE WINDOW FEATURE", filingDate: 1451433600000, business: null, primaryApplicantName: "Hand Held Products, Inc.", …} 2:{patentApplicationNumber: "523452345", title: "A patent for testing December filing dates", filingDate: 1387646460000, business: null, primaryApplicantName: "Tim Berners-Lee", …} 3:{patentApplicationNumber: "EP15192590", title: "WONDER FABRIC", filingDate: 1255388400000, business: null, primaryApplicantName: "Welspun Global Brands Limited", …} 4:{patentApplicationNumber: "EP67489", title: "A patent generated by createDummyPatentUiForSearchAddPatent()", filingDate: 1368458917000, business: null, primaryApplicantName: "Tim Berners-Lee", …}

$(document).ready(function(){
var state = 0;
  $(".info").hide();
  $("#b1").click(function(){
if(state ==0 ) {
   $('#q1').toggle();
state = 1;

 
}
   else  { 
       $("#q1").toggle();
$('#q2').toggle();
    }

  });
});

0 个答案:

没有答案