36129

Background image link by data array

Question:

I get this error in cytoscape.js:

"Do not assign mappings to elements without corresponding data (e.g. ele p for property background-image with data field linkImagem); try a [linkImagem] selector to limit scope to elements with linkImagem defined"

Look data array:

{ data: { id: 'atr1', classificacao : '1', backgroundColor : '#F79646', nomeAtributo : 'Bancos desconfortáveis', angulo : '0', valign : 'top', halign : 'right', linkImagem : 'http://www.fec.unicamp.br/~confterm/imagens/background/nodes/8.png' }, position: { x:220, y: 300 }, selected: false, selectable: false, locked: false, grabbable: false }

Look script style options:

.selector('node') .css({ 'label': 'data(nomeAtributo)', 'text-valign': 'data(valign)', 'text-halign': 'data(halign)', 'color' : '#000', 'font-size': '11px', 'background-fit': 'fit', 'background-color': 'data(backgroundColor)', 'background-image': 'data(linkImagem)', })

How I can solve this?

Answer1:

The solution is given to you in the error message. Either don't use mappers if you're not going to define the data for each matching element, or adjust your selectors so that they only match elements with the data defined.

Recommend

  • Mysql group_concat with sums also inside
  • String not fitting in label which is in a subview for swift
  • UITableViewCell change selectedBackgroundView alpha?
  • UIWebView horizontal bounce not working
  • Change day number color on click - not background
  • How do I bind multiple properties in an Android layout element
  • Javascript Array, Object, Date not defined
  • Laravel at least one field is required
  • Magento: where is the trigger of the custom cache?
  • insert radio value multiple data codeigniter in database to one row?
  • Can't get plist URL in Swift
  • What Makes These Two Array Adds Different?
  • JSON encode and decode on PHP
  • converter json to two dimensional array
  • Yii2: Finding file and getting path in a directory tree
  • KnockoutObservableArray with typed elements in TypeScript
  • Python ImageIO Gif Set Delay Between Frames
  • Clear activity stack before launching another activity
  • Add dynamic data to line chart from mysql database with highcharts
  • Symfony 2. CSRF token is invalid
  • Make new pandas columns based on pipe-delimited column with possible repeats
  • How to assign byte[] as a pointer in C#
  • Convert Type Decimal to Hex (string) in .NET 3.5
  • Appending Character to Character Array In C
  • PHP CURL timing out but CLI CURL works
  • Declaring variable dynamically in VB.net
  • CakePHP 2.0.4 - findBy magic methods with conditions
  • Jackson Parser: ignore deserializing for type mismatch
  • How do I alternate colors in Flat List (React Native)
  • Initializer list vs. initialization method
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Date difference with leap year
  • Rearranging Cells in UITableView Bug & Saving Changes
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Benchmarking RAM performance - UWP and C#
  • Angular 2 constructor injection vs direct access
  • How to stop GridView from loading again when I press back button?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check