Creditor purchase - batch sorting  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Creditor purchase - batch sorting

Postby neil.interactit » Mon Apr 03, 2017 10:48 am

Hi guys,

Happy Monday!

I've had a simple request, as part of a larger project, to provide sorting on the columns in the batch grid on the creditor purchases page. Enabling this functionality appeared easy ...

Code: Select all
        public void Setup(IJiwaForm jiwaForm, Plugin plugin)
        {
            if (!(jiwaForm is CreditorPurchases)) return;
            _form = (CreditorPurchases)jiwaForm;
            _form.grdLines.AllowSorting = true;
        }

But it doesn't have any affect. I've poked around and cannot find the alternate attribute that I should be manipulating. Any ideas?

Cheers,
Neil.
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: Creditor purchase - batch sorting  Topic is solved

Postby Mike.Sheen » Mon Apr 03, 2017 2:46 pm

In addition to setting the AllowSorting property of the grid to be true, you also need to set the AllowSort property per column.

This is not a standard column property, but encoded in the Tag of the column header - use the following to set it for each column:

Code: Select all
foreach(FarPoint.Win.Spread.Column column in _form.grdLines.ActiveSheet.Columns)
{
   // Set the AllowSort property, as when the columns were added this was forced to be false because we didn't want you to sort because we knew it would end in tears when trying to sort with disperals.
   string tag = _form.grdLines.ActiveSheet.ColumnHeader.Cells[1, column.Index].Tag.ToString();
   tag = _form.grdLines.StoreProperty(tag, "AllowSort", "1");
   _form.grdLines.ActiveSheet.ColumnHeader.Cells[1, column.Index].Tag = tag;                  
}
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Creditor purchase - batch sorting

Postby neil.interactit » Tue Apr 04, 2017 3:40 pm

Thanks Mike, works a treat!

I like your comment line there! I'll pass that on to the client.

Thanks,
Neil.
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 17 guests