Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
New Member
Posts: 6
Registered: ‎10-14-2011

How to edit the row order in editable grid? SLX 7.5.4

Hi folks,

 

I would like to be able to edit the row order in the SLX 7.5.4 editable grid.

 

Specifically, I want to re-order the line items in the Products tab on the Opportunity detail page. I'd be happy if I could select a row, then click up/down buttons to put it where I want. (This would be similar to the SLX Windows/LAN client.)

 

I've made some headway by customizing OpportunityProducts.js to include a Move Up button. I have this rough code. (Clearly, I would need to add some boundary checking here... Smiley Happy )

 

    id: 'MoveUp',

    icon: '~/ImageResource.axd?scope=global&type=Global_Images&key=Up_16x16',

   'alternateText': OpportunityProductsgrdOppProducts_Strings['grdOppProducts_MoveUp_ToolTip'] || 'Move Up',

   'handler': function () {

       if (this.selection != null) {

           var firstSelection = this.selection.getFirstSelected();

           var firstSelectionIndex = this.getItemIndex(firstSelection);

           var previousRow = this.getItem(firstSelectionIndex - 1);

           var tempNum = firstSelection.Sort;

           firstSelection.Sort = previousRow.Sort;

           previousRow.Sort = tempNum;

           this.update();

       }

 

And it works...um, sort of. The changes don't get written back to the database, even if I click Save.

 

I tried adding a call to saveChanges(), but couldn't get it to work. (Besides, I wouldn't want to save the change to the database immediately...only when the user is happy with the order and clicks the Save button.)

 

Any suggestions? Thanks!

Employee
Posts: 85
Registered: ‎04-01-2009

Re: How to edit the row order in editable grid? SLX 7.5.4

[ Edited ]

Ignore this post Smiley Happy Aren't grids populated with queries to the database? Unless there's a field on the record that remembers the order the user specifies, (for example a sales order line item number) how would a new query know what to sort on?

Silver Contributor
Posts: 835
Registered: ‎03-24-2009

Re: How to edit the row order in editable grid? SLX 7.5.4

That would be the OpportunityProduct.Sort property......when this comes into play we do the old 10, 20, 30, 40 trick for Excel spreadsheets....if someone needs to insert a row between 20 and 30 you simply change the sort order for this record to 25....

 

Aslo great for SalesOrder Items rows as well.....

 

In a former life, this is called quoting to the Customer.....not your.....order. If Home Depot or WalMart sees it 10, 30, 40, 20 it behooves you to present it that way......you can always sort by your companies 'sort' order for internal stuff.

RJ Samp
New Member
Posts: 6
Registered: ‎10-14-2011

Re: How to edit the row order in editable grid? SLX 7.5.4

You got it, RJ...that's the value I am looking to manipulate.

 

By default (I think), the Sort property has the header "Line #" in the Opportunity > Products tab.

 

My code above does part of what I want: it changes the values of the Sort property via JavaScript, without a postback. My problem is that the changes don't get saved when the user clicks the Save icon.

 

(I should also make sure the grid is sorted by the Sort property before the user starts rearranging the rows. Otherwise the results could seem nonsensical.)

New Member
Posts: 6
Registered: ‎10-14-2011

Re: How to edit the row order in editable grid? SLX 7.5.4

Ah, I might see another way to go here. Since the SLX Editable Grid is a Dojo DataGrid at its core, it may be possible to change it to a Dojo EnhancedGrid, which supports drag-and-drop of rows. That would be slick! I'm giving it a try now. If anyone is experienced in this department, give me a holler! Smiley Happy