reactjs


- AJAX DataTables - Adding a condition in 'columns' (render) which returns a button (Link) of React-Router is not working - ReactJS -


I have one DataTable which is:
export default class TablaMisIncidencias extends React.Component {
constructor() {
super();
}
componentDidMount() {
$('#idTablaMisIncidencias').DataTable({
responsive: true,
"paging": true,
"ordering": true,
select: false,
"lengthMenu": [[5, 10, 25, -1], [5, 10, 25, "Todas"]],
columnDefs: [
{
responsivePriority: 1,
targets: 0
},
{
responsivePriority: 2,
targets: 1
},
{
responsivePriority: 3,
targets: 5
},
{
responsivePriority: 4,
targets: 2
},
{
responsivePriority: 5,
targets: 3
},
{
responsivePriority: 6,
targets: 4
}
],
"ajax": {
"url": "https://jsonplaceholder.typicode.com/comments",
"dataSrc": ""
},
"columns": [
{ "data": "postId" },
{ "data": "id" },
{ "data": "name" },
{ "data": "name" },
{ "data": "body" },
{
sortable: false,
//HERE IS THE ERROR
"render": function ( data, type, full, meta ) {
//console.log(full)
if (full.postId == 0) {
return (`
<Link to="eee" class='btn btn-info btn-xs' title="Editar"><span class="glyphicon glyphicon-edit"></span> Editar</Link>
`);
} else {
return (`
<span class="glyphicon glyphicon-ok"></span> Tramitada
`);
}
}
},
]
});
}
If you see comment line: //HERE IS THE ERROR, on this function render I have two returs which are very similar. If postId == 0 it may returns one Link else may return one a. Both a and Link are the same. The unique difference is a is an HTML Tag and Link is a React-Router Tag. Well, when render returns a it is showed as a button (that is that I want, but I want that it happen too with Link); when render returns Link it is showed as text and the glyphicon, all separate, do not showed as button, and do not redirect neither. So, Why a is returned well and Link is not returned well? How could I solve this?
Thank you.

Related Links

How locally managing component's state in React/Redux
React Setting input value to value in a state array
Style concatenation using conditional styles
electron-react-boilerplate calling electron api
React Native Fecth blocks interations
Use .bind(this) in style attribute
React Bootstrap table : not able to update checkbox value when using dataFormat on one of the table columns
How can I disable laravel routes for ReactJs
What is the default value of React.PropTypes.func
How to properly add image (atomic) without 2 empty lines in Draft.js
Angular 2 - Redux/Subject-Thirdparty Component library interacting with its own routes
Compilation issue with react jsx component
connectiondefinitions resolvenode vs resolve in ObjectType
Firebase multi element removed
Separated Apps - but shared react-js-core
Routes on React, TypeError: Cannot read property 'getCurrentLocation' of undefined(…)

Categories

HOME
gulp
http
google-cloud-pubsub
itunesconnect
intellij-idea
sip
gsm
postgresql-9.3
process
ldap
abc
magento-1.9.2.1
cryengine
itext7
snmp
download
sugarcrm
autocad
sahi
theory
ldap-query
decoding
chef-recipe
android-notifications
lambda-calculus
brightway
passbook
pumping-lemma
ppp
scrapy-spider
oracle10g
orgchart
formtastic
luhn
epub
repeat
perf
android-databinding
iterm2
var
area
lex
nscollectionview
ssdp
mixed-models
glide-image-library
npoco
qtwebkit
togglebutton
hierarchical-clustering
rivets.js
hdpi
monaca
dynamic-linking
xamarin-test-cloud
hellosign
cc
pyautogui
blitz3d
android-music-player
easy68k
scikit-image
xcode7.1
cherry-pick
queuing
std
bluetooth-lowenergy-4.2
controlpanel
gitk
page-flipping
jsoncpp
android-filterable
vspackage
numerical-recipes
touch-typing
drools-guvnor
system.io.packaging
qf-test
facebook-likebox
thucydides
jfilechooser
ironworker
caroufredsel
objectdatasource
forward-declaration
windows-scheduler
nx
django-tinymce
qt5.1
algol
libx264
idoc
m3u
netzke
hypertable
ios6-maps
diazo
jqueryi-ui-buttonset
zend-validate
jqtransform
netduino
fxcopcmd
virtual-destructor
table-valued-parameters
authkit
vista64
hotfix
tracd

Resources

Encrypt Message