Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Ola, estou com um problema, tenho uma função com 3 parametros mas quando passa string ela não aceita , alguem poderia me ajudar?
a função é buscacodigoexclusaoitem, quando os valores sao numericos passa beleza, porem quando algum e string não aceita
textoHtml += "<tr id='centerItemslista2'>";
textoHtml += '<td onclick="{BuscaCodigoExclusaoItem('+arrayItems*.CODI_ORCAM+','+arrayItems**.DENTE+','+arrayItems**.COD_TRATAM+')}"><a href="#modalEItemOrcto" role="button" data-toggle="modal" ><i class="icon-trash" rel="tooltip" title="Excluir"></a></td>'*
* textoHtml += "<td onclick='{realizaOrcamento("+arrayItems**.sequencial+","+arrayItems**.VLR_DENTIS+","+arrayItems**.QTD_PREVIS+","+arrayItems**.VLR_TRATAM+","+dia1+","+mes1+","+ano1+","+dia2+","+mes2+","+ano2+","+arrayItems**.DENTI_CRED+")}' ><a href='#modalRealiza' role='button' data-toggle='modal'><i class='icon-retweet' rel='tooltip' title='Realizar'></i></a></td>"*
* textoHtml += "<td>"+arrayItems**.DENTE+"</td>";*
* textoHtml += "<td>"+arrayItems**.TRATAMENTO.substr(0,30)+"</td>";*
* textoHtml += "<td>"+arrayItems**.QTD_PREVIS+"</td>";*
if(arrayItems.QTD_REALIZ==null){qtd1=0;}else{qtd1=arrayItems.QTD_REALIZ;};
* textoHtml += "<td>"+qtd1+"</td>";*
* textoHtml += "<td>"+Number(arrayItems**.VLR_TRATAM).formatMoney()+"</td>";*
* textoHtml += "<td>"+arrayItems**.AUTORIZACA+"</td>";*
* textoHtml += "<td>"+data1+"</td>";*
if(arrayItems.DENTI_CRED==null){cdent1=0;}else{cdent1=arrayItems.DENTI_CRED;};
* textoHtml += "<td>"+cdent1+"</td>";*
* textoHtml += "<td>"+data2+"</td>";*
* textoHtml += "</tr>"; *
if(arrayItems.QTD_PREVIS!=null){totalOr=totalOr+(arrayItems.VLR_TRATAM1);}*
if(arrayItems.QTD_REALIZ!=null){totalRe=totalRe+(arrayItems.VLR_TRATAM1);}*
}
$('#gridItemOrctos').html(textoHtml);
document.getElementById('OValorTotal').value=Number(totalOr).formatMoney();
document.getElementById('OValorReal').value=Number(totalRe).formatMoney();
}
*//************************************************
function BuscaCodigoExclusaoItem(cod1){
document.getElementById('CCodigoOrcto').value=cod1;
document.getElementById('CCodigoDente').value=cod2;
document.getElementById('CCodigoTratam').value=cod3;
}
Ola rafael, tentei tirar a função number, mas nao resolveu, no inicio do texto acima , eu mostrei a parte onde esta o carregamento da função , passando parametros (codi_orcam+dente+tratam) estes são os meus problemas, quando o dente é numerico beleza. mas quando é ARS (string), não passa o parametro para a função, neste texto eu crio uma tabela dinamica, será q tem haver com a tabela sendo criada dinamicamente.
veja a função completa
function carregaItemsOrcto(arrayItems){
textoHtml='';
totalOr=0;
totalRe=0;
for(i=0;i<arrayItems.length;i++){
if(arrayItems*.DATA_REALI != null){*
* data1=inverteData(arrayItems**.DATA_REALI);*
* dia1=arrayItems**.DATA_REALI.substr(8,2);*
* mes1=arrayItems**.DATA_REALI.substr(5,2);*
* ano1=arrayItems**.DATA_REALI.substr(0,4);*
}else{
data1='';
dia1='';
mes1='';
ano1='';
}
* if(arrayItems**.DATA_PAGTO != null){*
* data2=inverteData(arrayItems**.DATA_PAGTO);*
* dia2=arrayItems**.DATA_PAGTO.substr(8,2);*
* mes2=arrayItems**.DATA_PAGTO.substr(5,2);*
* ano2=arrayItems**.DATA_PAGTO.substr(0,4);*
}else{
data2='';
dia2='0';
mes2='0';
ano2='0';
}
* //+arrayItems.CODI_ORCAM+','+arrayItems.DENTE+','+arrayItems**.COD_TRATAM+*
* textoHtml += "<tr id='centerItemslista2'>";*
* textoHtml += "<td onclick='{BuscaCodigoExclusaoItem("+arrayItems**.CODI_ORCAM+','+arrayItems**.DENTE+','+arrayItems**.COD_TRATAM+")}'><a href='#modalEItemOrcto' role='button' data-toggle='modal' ><i class='icon-trash' rel='tooltip' title='Excluir'></a></td>"*
* textoHtml += "<td onclick='{realizaOrcamento("+arrayItems**.sequencial+","+arrayItems**.VLR_DENTIS+","+arrayItems**.QTD_PREVIS+","+arrayItems**.VLR_TRATAM+","+dia1+","+mes1+","+ano1+","+dia2+","+mes2+","+ano2+","+arrayItems**.DENTI_CRED+")}' ><a href='#modalRealiza' role='button' data-toggle='modal'><i class='icon-retweet' rel='tooltip' title='Realizar'></i></a></td>"*
* textoHtml += "<td>"+arrayItems**.DENTE+"</td>";*
* textoHtml += "<td>"+arrayItems**.TRATAMENTO.substr(0,30)+"</td>";*
* textoHtml += "<td>"+arrayItems**.QTD_PREVIS+"</td>";*
if(arrayItems.QTD_REALIZ==null){qtd1=0;}else{qtd1=arrayItems.QTD_REALIZ;};
* textoHtml += "<td>"+qtd1+"</td>";*
* textoHtml += "<td>"+Number(arrayItems**.VLR_TRATAM).formatMoney()+"</td>";*
* textoHtml += "<td>"+arrayItems**.AUTORIZACA+"</td>";*
* textoHtml += "<td>"+data1+"</td>";*
if(arrayItems.DENTI_CRED==null){cdent1=0;}else{cdent1=arrayItems.DENTI_CRED;};
* textoHtml += "<td>"+cdent1+"</td>";*
* textoHtml += "<td>"+data2+"</td>";*
* textoHtml += "</tr>"; *
if(arrayItems.QTD_PREVIS!=null){totalOr=totalOr+(arrayItems.VLR_TRATAM1);}*
if(arrayItems.QTD_REALIZ!=null){totalRe=totalRe+(arrayItems.VLR_TRATAM1);}*
}
$('#gridItemOrctos').html(textoHtml);
document.getElementById('OValorTotal').value=Number(totalOr).formatMoney();
document.getElementById('OValorReal').value=Number(totalRe).formatMoney();
}
*//************************************************
function BuscaCodigoExclusaoItem(cod1){
document.getElementById('CCodigoOrcto').value=cod1;
//document.getElementById('CCodigoDente').value=cod2;
//document.getElementById('CCodigoTratam').value=cod3;
}
*//************************************************
desculpe a ultima funcao faltou algumas informações , pq eu estava fazendo testes.
function BuscaCodigoExclusaoItem(cod1,cod2,cod3){
document.getElementById('CCodigoOrcto').value=cod1;
document.getElementById('CCodigoDente').value=cod2;
document.getElementById('CCodigoTratam').value=cod3;
}depois de muito esforço e um pouco de sono perdido resolvido
textoHtml += "<td onclick='BuscaCodigoExclusaoItem("+arrayItems.CODI_ORCAM+","+'"'+arrayItems.DENTE+'"'+","+arrayItems.COD_TRATAM+")'><a href='#modalEItemOrcto' role='button' data-toggle='modal' ><i class='icon-trash' rel='tooltip' title='Excluir'></a></td>"
O erro está na função number
http://www.w3schools.com/jsref/jsref_number.asp