summaryrefslogtreecommitdiff
path: root/libs/js/jquery-geo-1.0a4/docs/geomap/remove.html
blob: 3e00bec74a6e1e1a7bc65a36a4ce0aee50b85a4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!doctype html>  

<html lang="en" class="no-js">
<head>
  <meta charset="utf-8">

  <title>remove | geomap</title>
  <meta name="description" content="geomap remove method">
  <meta name="author" content="Ryan Westphal">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <link rel="stylesheet" href="../css/style.css?v=2">
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
</head>

<body>

  <div id="remove" data-role="page">
    <div data-role="header" data-theme="e">
      <h1>remove</h1>
    </div>
    
    <div data-role="content">
      <table>
        <tr>
          <th>return type</th>
          <td>jQuery collection</td>
        </tr>
        <tr>
          <th>syntax</th>
          <td>.geomap( &quot;remove&quot;, Object shape [ , Boolean refresh ] )</td>
        </tr>
        <tr>
          <th>usage</th>
          <td><pre><code>$( <i>map or service selector</i> ).geomap( &quot;remove&quot;, existingShape )
$( <i>map or service selector</i> ).geomap( &quot;remove&quot;, existingShape, false )</code></pre></td>
        </tr>
      </table>
      <p>The remove method removes a shape you have previously added with the append method. The existing shape can be an object reference used in a call to <a href="append.html">append</a> that you have held on to or one that you retrieved by using the <a href="find.html">find</a> method.</p>
      <p>The jQuery UI widget factory returns the original jQuery collection to maintain call chaining.</p>
      <h2>delaying refresh</h2>
      <p>The optional refresh argument determines if geomap refreshes the map graphics after this call to remove. It defaults to true. If you pass false, geomap will remove the shape internally but not immediately redraw the graphics. The changes will display if the user moves the map or you call geomap's refresh method.</p>
      <p>If the shape is not found on the specified service, the map is not changed and will not be refreshed even if you pass true for the refresh argument.</p>
      <h2>service-level shapes</h2>
      <p>Similar to how you can append shapes to specific services, you can remove shapes from specific services as well.</p>
      <p>You do this by targeting a service inside a map instead of the map itself for your call to geomap's remove method. For example, the default map service has the CSS class: osm. We can remove a shape from that service specifically by using jQuery to target the service:</p>
      <pre><code>$( &quot;#map .osm&quot; ).geomap( &quot;remove&quot;, shape );</code></pre>
      <p>Shapes appended to a specific service will not be removed by calling remove on the map itself. For example, the shape will remain after this sequence:<p>
      <pre><code>$( &quot;#map .osm&quot; ).geomap( &quot;append&quot;, shape );
$( &quot;#map&quot; ).geomap( &quot;remove&quot;, shape );</code></pre>
      <p>To remove all references to a shape from the map and all services, you can use the comma selector and the built-in geo-service CSS class:</p>
      <pre><code><span class="comment">// remove the shape from both the map widget and any services</span>
$( &quot;#map,#map .geo-service&quot; ).geomap( &quot;remove&quot;, shape );</code></pre>
    </div>
  </div> <!-- end of #container -->

  <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
  <script src="http://code.jquerygeo.com/jquery.geo-1.0a4.min.js"></script>
  <script src="../js/script.js"></script>
  <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</body>
</html>