PDA

View Full Version : Want to have the inventory search box multi purpose



alloowishus
November 21st, 2024, 18:51
I was able to change my inventory search drop down box, originally it only filtered by the item type and was prepopulated, I changed it to filter by name and removed the item type population of the drop down. This is in the template_char.xml file:

<template name="list_charinv">
<windowlist>
<datasource>.inventorylist</datasource>
<class>char_invitem</class>
<allowcreate />
<allowdelete />
<filter control="typefilter" />
<filteron control="name" />
<script file="campaign/scripts/char_invlist.lua" />
</windowlist>
</template>

However, what I would like is that I keep the type in the dropdown, so if they type a word in the box, it searches by name, but if the text value matches an item type (i.e. "Accessory","Armor","Weapon" etc) then it searches by type. Is this possible?

Moon Wizard
November 22nd, 2024, 01:01
You’d have to completely override the list filtering (onFilter) and update of list when the filter box changes. You won’t be able to use the default filtering at all, since you need to write the logic to know which field to check based on the value in the filter box.

Regards,
JPG