jQWidgets Forums

jQuery UI Widgets Forums Angular Problem to display the data using Angular 5

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  Ivo Zhulev 7 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • kelsey
    Participant

    Hi,

    I have a little issue in my jqxGrid.
    I’m using a VB’s Web API and its return to me a JSON data.

    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
    [{"Codigo_Cotacao":1,"itcmCodigo_Mercadoria":1,"itcmDescricao":"Anador","itcmQuantidade":2,"itccValor":10.50,"itccObservacoes":"Teste"},{"Codigo_Cotacao":1,"itcmCodigo_Mercadoria":2,"itcmDescricao":"Paracetomol","itcmQuantidade":2,"itccValor":0.00,"itccObservacoes":""}]
    </string>

    The problem is: when I put the Web API’s link in url, its return to me a 270 empty rows, however, when I use local json-server, the information are displayed.
    What should be the problem?

    Source and Adapter Code

      this.source =
        // tslint:disable-next-line:one-line
        {
            datatype: 'json',
            datafields:
            [
              { name: 'Codigo_Cotacao', type: 'number'},
              { name: 'itcmCodigo_Mercadoria', type: 'number' },
              { name: 'itcmDescricao', type: 'string' },
              { name: 'itcmQuantidade', type: 'number' },
              { name: 'itccValor', type: 'number'},
              { name: 'itccObservacoes', type: 'string'}
            ],
            url: <code>${COTACAO_API}/api/Itens_Cotacao_Mercadoria?codigo_cotacao=${codigo_cotacao}</code>
        };
    
        this.dataAdapter = new jqx.dataAdapter(this.source, {
            formatData: function (data) {
                return {};
            },
            loadError: function (jqXHR, status, error) {
                // console.log("loadError> jqXHR = " + jqXHR);
                console.log('loadError> jqXHR.responseText: ' + jqXHR.responseText);
                console.log('loadError> jqXHR.getResponseHeader: ' + jqXHR.getResponseHeader);
                console.log('loadError> jqXHR.getAllResponseHeaders: ' + jqXHR.getAllResponseHeaders);
                console.log('loadError> status = ' + status);
                console.log('loadError> error = ' + error);
              },
              downloadComplete: function (data, textStatus, jqXHR){
                  console.log(data)
            }
        })

    *The download complete returns me a JSON data, same as posted.

    Regards,
    Kelsey


    Ivo Zhulev
    Participant

    Hi kelsey,

    First of all, are you sure the API returns the data as intended?

    Best Regards,
    Ivo

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.