3.2.0

limited data displayed after sorting a search

I was able to implement a search function by using a function outside the grid, basically what it does is this:

function performSearch(){
    
         // sets a temporary clearData array with all the data
    clearData				=	obj_data;

        // grabs the object by the id
    var valObj				=	getObjByID("searchFld");
    var colObj				=	getObjByID("searchCol");

         // gets the columns and search value
    var col					=	colObj.value;
    var value				=	valObj.value;

        // sets the up the searchData array and the counter
    var searchData	= 	Array();
    var ct			=	0;

    for(i=0; i<obj_data.length; i++){

                // gets the data from a particular column
        var searchStr		=	obj_data[i][col].toString();

                 // performs an .indexOf on using the value gotten above
        if(searchStr.indexOf(value) > -1){
                        
                         // inserts the data into another array
            searchData[searchData.length]	=	obj_data[i];

                         // increments the counter
            ct++;

        }

    }

        //  if the counter is greater than zero, set the count, and the data, do a refersh
    if(ct > 0){

        obj.setProperty("data/count", ct);
        obj.setProperty("data/text", function(i, j){return searchData[i][j]});
        obj.refresh();
        goToPage(0);					


    } else {
                 // if not results were found alert the person
        alert("No results were found! Please try again.");

    }

}


and it works perfectly!!! even though I have input fields that update the data in the grid....

now when the user to clear the search, the following script is called:

function clearSearch(){

         // sets the original count
    obj.setProperty("data/count", 825);

        // sets the global clearObject and refreshes the page
    obj.setProperty("data/text", function(i, j){return clearData[i][j]});
    obj.refresh();
    goToPage(0);

}



the problem is that for example:

825 original records
when the user does the search, it brings back 19 records
when the user clears the search, it brings back the original data, shows all the rows correctly

but if the user does this:

825 original records
when the user does the search, it brings back 19 records
the user does a sort
when the user clears the search, it brings back the original data, shows only the first 19 rows or whatever the search number was



I read previous posts and tried to do setProperty, setRowProperty, setDataProperty to no avail, what do I need to set when I call the clearSearch function that will display all the data, no matter if the user does a sort or not???

Thank you for help.

PS: awesome tool, keep up the good work
November 9,

This topic is archived.

See also:


Back to support forum