I'm using transformedData method as said in this post but with a different propose. I want to export the grids data. I was following 'Suggestion 2' in this post but then I realized that dataView method returns only the current page rows. I want to get filtered rows but from every page (from transformedData documentation that would be the second option: "2. After filtering before paging"). However I've tried and it doesn't work correctly. It returns the result from the last used transformedData method.
Here you can see this odd behavior.
I need to get the records after filtering and sorting but before paging. How can I do?
Hello intecomp,
I investigated your sample in jsFiddle and I noticed that you're looping through an object that you haven't defined: 'filteredData'. I assume that while you were trying to adopt the code from this sample: http://jsfiddle.net/u3jr6fs1/ you didn't change the name of the transformedData object variable. I modified your sample and now it returns the correct data after filtering from every page: http://jsfiddle.net/u3jr6fs1/5/ as per your requirement. If you need further assistance, please let me know.
Regards,
Tsanna
Hello Tsanna, thanks for your reply but I'm afraid the bug is still there.
You were right about using the undefined filteredData variable but it wasn't the problem. I made a few changes to your script:
The script with those two changed works great, you can see it here: http://jsfiddle.net/u3jr6fs1/8/.
But then, I made a second script which adds the call to a function in the click event. That function only calls a few times the method transformedData. It doesn't even use the results. However, the behavior then changes. After that function's execution, the result from transformedData('afterfilteringbeforepaging') is wrong. This second script is here: http://jsfiddle.net/u3jr6fs1/6/.
Looking forward to hear form you,
Diego.
Hi intecomp,
Actually 'useTransformedDataAFewTimes' function in your code does nothing. You have declared only several variables of the transformedData object in this function and this does not affect the end result. Since you're using 'afterfilteringbeforepaging' as transformed execution, then the end result should contain only the results from the current page. I tested your sample and it does exactly the same. What do you find for inappropriate behavior in this case? Please explain me what do you expect to see after the transformation, you may give me also an example to understand you better. Waiting for your reply.
Do you really see the same results? I've run both scripts I gave you in Firefox, Chrome and IE11 and they always show different results. In both cases I'm calling 'afterfilteringbeforepaging' so I expect to get the 9 names in the list when the buttons is clicked (unless, of course, you applied any filter before). This first script does what expected, you click the button and the 9 names appear below. However this second script only shows 3 names (those from the first page) although it is also using 'afterfilteringbeforepaging' and its only difference is calling 'useTransformedDataAFewTimes' which, as you said, does nothing (only sets a few variables without even using them).
I want to use transformedData method with 'afterfilteringbeforepaging' and get the all rows that match the filter criteria whether they are in the current page or not. This works "at the beginning", but after a few calls to the method, 'afterfilteringbeforepaging' returns the last result of the method (either 'afterfilteringandpaging' or 'priortofilteringandpaging').
Now I've got your point and after further testing of your code I believe that the returned result due to the transformed data call is correct. The explanation for that is the following: you're calling transformedData method multiple times within the 'useTransformedDataFewTimes' function and with every next time the data is transformed according to its previous state. Therefore when you're calling afterfilteringbeforepaging transform execution for the second time (var afterfilteringbeforepaging2 = dataSource.transformedData('afterfilteringbeforepaging').length), it will transform the data based on the previous transformation call (var afterfilteringandpaging = dataSource.transformedData('afterfilteringandpaging').length) which returns 3 as result. This transformation schema will apply also in the button click event, where you're calling the function and the end result will show only 3 records. So please note that the consequently call of transformeData API method applies on the previously made transformations, it does not start every time from the initial state of the data source. If you want all the records to be shown after transformation of the data source, then you may remove this function call if not necessary for your requirement or please explain me what is your exact purpose of using this function in the current scenario. Waiting for your reply.
Ok, so maybe transformedData is not the function I need.
What I need is to get from the original data source every record that match the filter criteria (if any) that might be shown (current page) or might not be visible (other page). What I mean is, the execution of afterfilteringbeforepaging but using always the original datasource no matter what has been done or called before. Please help me because I really don't understand how I am supposed to do this and it is taking me much longer than it should.
Thanks,
Diego
Hello,
Your development issue has been addressed in our latest service release which is available for download.
Please let me know if you come across any further issues with the new service release or if you have any further questions .
Kind Regards,
Petko Zhekov
Software Developer
Infragistics, Inc.
Thank you for reporting this.
I have asked our engineering staff to examine this further. To ensure that it will receive attention, I have logged this behaviour in our internal tracking system with a Development ID of 192590. A support case is created on your behalf with number CAS-153330-Q8D7G4, so that you can be notified when the bug is fixed.
You can find your active cases under Account - Support Activity in our website. Select your ticket and go to Development Issues tab to view the status of related bugs.
For now I can give you a temporary workaround. Use this code to get the filtered data without the paging applied to it:
function getData() { var ds = $('#table1').data('igGrid').dataSource; var transData; if (ds._filter) { transData = ds._filteredData; } else { transData = ds.data(); } return transData; }
Let me know if I may be of further assistance.
Kind Regards, Petko Zhekov Senior Software Engineer
Hello Tsanna.
As I told you in my last post, I need to use a different method. This is because I'm using IgniteUI Grid in a web application in a lot of pages. Some of those pages, before and after needing the records (filtered but not paged) use different methods of the grid. I need to make sure that I have a function that whenever its called it returns that information. No matter what has been called before and without affecting what might be called after.
Beside my very specific scenario what I need is a really basic functionality. I want to get every datasource's object which related record is currently on the grid (being shown at current page or not).
You can still use transformedData method, but I could not understand why you want to call it so many times one after other? Calling transformedData method with transformed execution: 'afterfilteringbeforepaging' will return all records through the whole data source after filtering, no matter what the current page is. Please let me know why is so necessary for you to use custom function that reapplies the transformations?