Open Closed

I cannot send the 'Sorting' parameter from the frontend JS to the backend. #5469


User avatar
0
inavarro.cp created

*** ABP Framework version: v6.0.1

  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Auth Server Separated (Angular): Tired
  • Exception message and stack trace:
  • Steps to reproduce the issue:"**

Hi, I am trying to pass the 'Sorting' field as a parameter from the frontend JS to the backend, but it is not being passed, whereas when I try to pass another parameter like 'FilterText', it does get passed. I am using this function: var getFilter = function () { return { filterText: "Hello", sorting: "sort" }; };

'Sorting' being an inherited field, may not be treated the same way to pass it as a parameter. Could you help me?


9 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    You may try like this for sorting value ->

    sorting: "id DESC"

  • User Avatar
    0
    inavarro.cp created

    It remains the same, the response I am getting in the Backend is null.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    Are you sure you have a dto which inherits PagedAndSortedResultRequestDto can you send a screenshot of the network request from developer tools window

  • User Avatar
    0
    inavarro.cp created

    The inheritance with the class PagedAndSortedResultRequestDto was already implemented.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    Can you try with postman because Sorting is a query parameter. i am not able to reproduce the issue at my end.

    ?sorting=id desc&skipCount=0

    can you send me a screenshot of you javascript code how you are calling the api and a network request screnshot?

  • User Avatar
    0
    inavarro.cp created

    In Postman, I receive the 'Sorting' parameter correctly, which makes it clear that the issue lies in the Frontend. I am sending you a screenshot of my JS code.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    can you send the column defs.? like this below : https://docs.abp.io/en/abp/latest/UI/AspNetCore/Data-Tables

  • User Avatar
    0
    inavarro.cp created

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi

    any reason you are passing sorting like this

    sorting is a part of column definition specific to the data property. it should work by default you don't need to pass it. it will automatically pass the data as a property name for you. please remove and then try again.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11