how to hide the layer name in legend? like the "Rivers" in the example Map with legend , Or can i change the text ?
See here the same example with different layer name Edit fiddle - JSFiddle
When you are creating the layerInfo in order to pass it on the Legend widget change the layer title
....
map.on("layers-add-result", function (evt) {
var layerInfo = arrayUtils.map(evt.layers, function (layer, index) {
if (layer.layer.name==="Rivers"){
return {layer:layer.layer, title:"My River"};
}else{
return {layer:layer.layer, title:layer.layer.name};
}
});
...
Also it is more easily to use webmap for the map creation and control the layer name, legend visibility e.t.c from the webmap.