iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
The grid sorts just fine when we click on the column header. However, when we select sort from the column context menu, it causes a javascript crash.
I found the problem. The columnObject passed to the OnColumnSort client-side handler is different when sorting from the menu than directly from the column header.
Sorting on column header produces:
columnObject.Name "assignedToLastFirstName" columnObject.ColumnMember "assignedToLastFirstName" columnObject.SortOrder "Descending"
Where sorting from the context menu does not populate ColumnMember:
columnObject.Name "assignedToLastFirstName" columnObject.ColumnMember undefined columnObject.SortOrder "Ascending"
Hi Yousif,
Forgive me, actually, when we are sorting using ContextMenu, the ColumnMember property is not designed for that scenario (using context menu). Since, basically the ColumnMember returns a string value of its column name, here is snippet of the workaround to get the column name every time we do sort either with context menu or from column header:
function WebGrid1_OnColumnSort(controlId, columnObject) { var WebGrid1 = ISGetObject(controlId); if (columnObject.DataMember == null) alert(columnObject.ColumnMember); else alert(columnObject.DataMember); return true; }
I hope it helps. Thank you and have a nice day.
Best Regards,
Andi Santoso
Forgive me, however, I am not able to replicate the issue of yours. Perhaps, I am missing on someting. It would be much better if you can kindly give me your simple running sample that replicate the issue. Because I have tried to create a simple WebGrid and I have tried to do both sorting ways, from column header and context menu, and the results was just fine.
Thank you and have a nice day.
If you create a function that's called as your OnColumnSort client-side handler and you try to access columnObject.ColumnMember when it's undefined, your method will crash and therefore crashes the sort routine altogether because the method never returns true. This is because, as I explained, when called from the context menu, this object's member is undefined.
Creating a simple grid and using the sort isn't sufficient. Use a simple javascript function like this and then sort using both the column header and the context menu:
function OnColumnSort(controlId, columnObject) { alert(columnObject.ColumnMember); }
Of course make sure to assign this function to your grid's client side settings.
Forgive me again, however, I am not able to replicate the issue. Here is a link of video that I made, it demonstrates the scenario. If we are using context menu, the columnObject.ColumnMember, it is not existed that is why it gives us an undefined alert. In my video, even after I try to sort using context menu and the alert is undefined, the sorting is still working.
Hi Andi,
You have to actually act on the undefined object. My example above was just to show you that it IS undefined. If you then act on the object, it'll cause an exception and therefore kill the sort. So do something like this, for example, assuming oGrid is your grid object:
oGrid.AddInput("UserColumnMember", columnObject.ColumnMember);
If you put this line BEFORE the alert, the call will cause an exception when ColumnMember is underfined and will crash the call and never gets to the alert and therefore never finishes the routine.
And even if the sort still works due to no code possibly causing an exception, you need to let the development team know about this problem so they can fix it. This property should be populated regardless of where the user is sorting.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname