You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Search selection dropdowns can specify <a href="/behaviors/api.html">API settings</a> for retrieving values remotely, this can use either a named API <code>action</code> or <code>url</code>.</p>
1270
-
<p class="ignored">Using API can allow users to select choices from large datasets that would be too large to include directly in page markups.</p>
1271
-
<p class="ignored">If your backend is not designed to return the correct markup you can use API's <code><a href="/behaviors/api.html#adjusting-server-responses">onResponse</a></code> callback to adjust the format of an API response after it is received from the server.</p>
1272
-
<p class="ignored">Requests for the same API endpoints will automatically cached locally, to avoid server roundtrips. You can disable this by adjusting the <code>cache</code> API setting.</p>
1273
-
<div class="ui ignored positive message">When a user refreshes the page, selection labels are automatically recreated by using <code>sessionStorage</code> to store the corresponding names for selected values. You can disable this feature by setting <code>saveRemoteData: false</code></div>
<h4 class="ui header">Using Returned API Results</h4>
1424
+
<p>Search selection dropdowns can specify <a href="/behaviors/api.html">API settings</a> for retrieving values remotely, this can use either a named API <code>action</code> or <code>url</code>.</p>
1425
+
<p class="ignored">Using API can allow users to select choices from large datasets that would be too large to include directly in page markups.</p>
1426
+
<p class="ignored">If your backend is not designed to return the correct markup you can use API's <code><a href="/behaviors/api.html#adjusting-server-responses">onResponse</a></code> callback to adjust the format of an API response after it is received from the server.</p>
1427
+
<p class="ignored">Requests for the same API endpoints will automatically cached locally, to avoid server roundtrips. You can disable this by adjusting the <code>cache</code> API setting.</p>
1428
+
<div class="ui ignored positive message">When a user refreshes the page, selection labels are automatically recreated by using <code>sessionStorage</code> to store the corresponding names for selected values. You can disable this feature by setting <code>saveRemoteData: false</code></div>
// this url parses query server side and returns filtered results
1459
+
url: '//api.semantic-ui.com/tags/{query}'
1460
+
},
1461
+
})
1462
+
;
1463
+
</div>
1464
+
<div class="code" data-type="JSON">
1465
+
// Expected server response
1466
+
{
1467
+
"success": true,
1468
+
"results": [
1469
+
{
1470
+
// name displayed in dropdown
1471
+
"name" : "Choice 1",
1472
+
1473
+
// selected value
1474
+
"value" : "value1",
1475
+
1476
+
// name displayed after selection (optional)
1477
+
"text" : "Choice 1"
1478
+
1479
+
// whether field should be displayed as disabled (optional)
1480
+
"disabled" : false
1481
+
1482
+
},
1483
+
{
1484
+
"name" : "Choice 2",
1485
+
"value" : "value2",
1486
+
"text" : "Choice 2"
1487
+
},
1488
+
{
1489
+
"name" : "Choice 3",
1490
+
"value" : "value3",
1491
+
"text" : "Choice 3"
1492
+
},
1493
+
{
1494
+
"name" : "Choice 4",
1495
+
"value" : "value4",
1496
+
"text" : "Choice 4"
1497
+
},
1498
+
{
1499
+
"name" : "Choice 5",
1500
+
"value" : "value5",
1501
+
"text" : "Choice 5"
1502
+
}
1503
+
]
1504
+
}
1505
+
</div>
1506
+
</div>
1507
+
1508
+
<div class="remote no example">
1509
+
<h4 class="ui header">Using Returned Queryset</h4>
1510
+
<p>Ideally API results should only return values <b>matching the passed query term</b> to reduce transmissions over the wire, however as a convenience, you may also return the full set of results from an API endpoint and filter them against the query clientside using the setting <code>filterAPIResults: true</code>.</p>
0 commit comments