This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Para exportar componentes, se deben seguir los siguientes pasos: | |
• En un archivo js indicar los import correspondientes a las librerias react y react-dom, como otras(con rutas relativas). | |
Ejemplo: statistics-toolbar.js | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import token from '../services/token-service'; | |
import layers from '../services/layers-service'; | |
import mymap from '../services/map-service'; | |
• Construir el componente. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Para exportar a excel: | |
//Esta es la funcion para el boton exportar. | |
onClickExport(){ | |
//console.log("asd export"); | |
var data = this.state.interruptions; | |
var exportResults = []; | |
for (var i = 0; i < data.length; i++) { | |
exportResults.push(translator(data[i])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Referencia: http://resources.arcgis.com/en/help/rest/apiref/query.html | |
{ | |
output.statistics: [ | |
{ | |
"statisticType": "count", | |
"onStatisticField": "zona", | |
"outStatisticFieldName": "cantidad" | |
} | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//API.JS | |
const sql = require('mssql'); | |
const fs = require('fs'); | |
var pool; | |
var config = { | |
server: "serverip\\instance", | |
database: "mydatabase", | |
user: "myuser", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//server.js | |
const sql = require('mssql'); | |
var sqlQuery = function(config,query){ | |
var res = {complete: '',results: ''}; | |
var promise = new Promise((resolve,reject)=>{ | |
var pool = new sql.connect(config, err=>{ | |
var request = new sql.Request(pool); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*The tab component doesnt work too well when u try to render it. | |
https://github.com/reactjs/react-tabs | |
Thanks to : deepaksisodiya | |
"Removing the selectedIndex={0} is not a solution, | |
You need to set it by state, like | |
selectedIndex={this.state.selectedTab} | |
also initialise selectedTab state to your preferred tab. | |
then on onSelect={this._handleSelect} event of Tabs, set the selectedTab again. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> | |
<title>Layer List Dijit</title> | |
<link rel="stylesheet" href="https://js.arcgis.com/3.17/dijit/themes/claro/claro.css"> | |
<link rel="stylesheet" href="https://js.arcgis.com/3.17/esri/css/esri.css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Ex: We have this var in a state in react. | |
var obj = { | |
obs: "hello", | |
id: 1 | |
} | |
... | |
//To modify "obs" we do: | |
this.setState({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const webpack = require('webpack'); | |
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
const reactToolboxVariables = { | |
'color-text': '#444548', | |
/* Note that you can use global colors and variables */ | |
'color-primary': 'rgb(218,41,28);', | |
'button-height': '30px', | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: http://stackoverflow.com/questions/39426819/selecting-a-row-in-react-griddle-and-changing-tr-background-color | |
First: | |
class ComponentWithGriddle extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
selectedRowId: 0, | |
}; |
NewerOlder