Home > Back-end >  D3 small white asked how to deal with this kind of circumstance, high marks for help
D3 small white asked how to deal with this kind of circumstance, high marks for help

Time:09-18

My result is based on database dynamic query JSON file, there are more than 1000, on the interface shows very much, now want to more than 10, the rest is expressed in a node, and put the special nodes behind the JSON,
D3. Layout. Tree (). The size (height, halfWidth]), children (function (d) {return d.w inners. }),

The children (function (d) {return d.w inners. }), how to deal with here can only pick up before 10?

CodePudding user response:

Database paging query

For example:
Public TabInnLoc queryLastLocRecordByToken (String token) {
//TODO Auto - generated method stub
//TabInnLoc res;
String strRequeryHql="";
strRequeryHql="from TabInnLoc TAB the Where TAB. The token=" + "'" + token + "' order by TAB. The uptime desc limit 1";

System. The out. Println (" strRequeryHql===: "+ strRequeryHql);

Session ses=getSession ();
Query Query=ses. CreateQuery (strRequeryHql) setFirstResult (0). The setMaxResults (10);


List ImLists=query. The list ();
Ses. The close ();

If (imLists==null | | imLists. IsEmpty ())
{
return null;
}
Return imLists. Get (0);
}

CodePudding user response:

Paging display data,
Article 1000, the content is too much, every time take 10, according to article 10, the service side pressure is small, the data transmission efficiency is also high, such as the user wants to see the data, following the article 10 again using paging query, query the data behind the display to the user, every time is according to article 10,

Json string data inside, it must be an array, it is not ok to split the array, you create a new array, and then, through about 1000 array, traverse the former only 10 elements, with each cycle pop out of an element, into the new array, after 10 times, two arrays is split,

CodePudding user response:

Json structure is how to
[{}] so data. The splice (0, 10); Can take 10 to the front

CodePudding user response:

D.w inners. Splice (0, 10) so that you can cut out the top 10 data
Will lead to the original data loss cut out data, careful, recommend paging query
  • Related