Open Closed

abp-lookup-typeahead is not maintaining selected record at the time of edit. if record does not falls under first 10 records #7534


User avatar
0
vipulbuoyancy created

I have added an "abp-lookup-typeahead" in my page. it is working fine and giving a proper result with the type search. But when I open a page for and details, previous value is not maintained selected and I am getting below error in browser console.

  • ABP Framework version: v8.1.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: at Object.next (volo-abp.commercial.ng.ui.mjs:238:49) at ConsumerObserver.next (Subscriber.js:91:33) at SafeSubscriber._next (Subscriber.js:60:26) at SafeSubscriber.next (Subscriber.js:31:18) at OperatorSubscriber._next (Subscriber.js:60:26) at OperatorSubscriber.next (Subscriber.js:31:18) at map.js:7:24 at OperatorSubscriber._next (OperatorSubscriber.js:13:21) at OperatorSubscriber.next (Subscriber.js:31:18) at filter.js:6:128
  • Steps to reproduce the issue:
  1. Create a new component in Angular.
  2. add abp-lookup-typehead, in my case below is the code <abp-lookup-typeahead cid="invoice-customer-id" formControlName="customerDetailId" displayNameProp="displayName" [getFn]="invoiceService.getCustomerDetailLookup" [editingData]="selectedCustomer.fullName" (ngModelChange)="onCustomerChanged($event)"></abp-lookup-typeahead>

"selectedCustomer.fullName" has the name of the previously added customer.

  1. save the value in database
  2. refresh the page

I went through the below document and only found about editingData property which is not usefull to me. https://docs.abp.io/en/commercial/latest/ui/angular/lookup-components

Please help me to fix this or let me know if there is any workaround.

Thank you.


3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry i could not reproduce the problem, could you share a simple project with me? i will check it. thanks

    shiwei.liang@volosoft.com

  • User Avatar
    0
    vipulbuoyancy created

    Hi @liangshiwei.

    Thank you for your reply.

    It is working fine for me, wherever I have generated Lookup typehead from abp suite. But it is not working where I have added the lookup typehead in new page, it is not maintaining the selected data.

    So I think I am passing the "editingData" incorrectly. Can you please help me with the correct format of "editingData"?

    So like in "getfn" we are passing a array of object with id & displayName property. And in autogenerated code from abp suite "editingData" is assigned with the entire object of the entity from the navigation property.

    In my case I don't have entire object, I just have id & displayname, What should be the value of "editingData" in my case?

    Thank you.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    editingData is an object, you can create an object manually

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09