Connector_text_filter


#1

Hi,

Is there a way to switch the #connector_text_filter function to update its list based on JSON data?

Some info about my project.
html + dhtmlx + spring REST API generating JSON grid data works fine.

The page runs and I can see my JSON data in the dhtmlx-grid without any problems.
I can do dynamic paging by loading part of data specifying pos and total_count as required by dhtmlx-grid.

Now the problem:
When I enter something in the text filter line my REST API receives the parameter and generates a valid JSON code as an answer. I found out that the connector_text_filter seems to require XML data instead of JSON.

Is there a way to switch the #connector_text_filter to the JSON format?
(I don’t want to implement another XML functions for the text filter function only as I am receiving more than 100k records)

I am using below version of dhtmlx suite
Product Name: dhtmlxSuite
Version: 4.4
Edition: Professional

thanks


#2

The connector_text_filter was designed fo rthe dhtmlxConnector, which loads the data in the xml format.
https://docs.dhtmlx.com/connector__php__filtration.html#in-header_filter_types
Unfortunately it is not available to change its behavior without source code modifications.
I can suggest You to create a custom filter:
https://docs.dhtmlx.com/grid__dynamic_loading.html#step4filterdatapassextraparameterstotheserver


#3

thanks sematik for your reply


#4

I am using below version of dhtmlx suite
Product Name: dhtmlxSuite
Version: 4.4
Edition: Professional

Does #connector_text_filter works with JSON format in higher version than I am using. Or Dhtmlx can provide such feature if requested.

thanks


#5

grid connector loads the data in the xml format. It is aldso actual for the dhtmlxGrid 5.2 version.
We have no plans to extend it to the json fromat data. So its filter works only for the xml data format.
You may use the onFilterStart event:
https://docs.dhtmlx.com/api__dhtmlxgrid_onfilterstart_event.html
to catch the filtering process starting block the default filtering (“return false”) and send your own data reloading request with the needed parameters to simulate the filtering. It will have the similar behavior as the connector_text_filter.
It is described here:
https://docs.dhtmlx.com/grid__dynamic_loading.html#step4filterdatapassextraparameterstotheserver


#6

hi sematik
I have implemented dhtmlx grid as you have mentioned however the result is not what is expected. After grid is filtered the filter text boxes under header columns are lost. Also pagination have stopped working. I am posting my code to load the grid.

function makegrid(){
var mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setImagePath("…/codebase/imgs/");
mygrid.setSkin(“dhx_skyblue”);
mygrid.enablePaging(true, 100, 5, “pagingArea”, true);

        mygrid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
    mygrid.init();
        mygrid.load("serverURL","js");

        mygrid.attachEvent("onFilterStart", function(indexes,values){
	console.log("onFilterStart ",indexes,values);
	mygrid.clearAll();
         //I am attaching grid filter again as those are lost after grid is loaded
		 
            mygrid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");

	mygrid.load("serverURL?filterKeyValue=part~"+values[1],"js");
            return false;
        });
    }

#7

Unfortunately the porblem cannot be reconstructed locally.

	mygrid.clearAll();
         //I am attaching grid filter again as those are lost after grid is loaded

clearAll() method just clears the data in your grid. It should not remove the filters fro myour header.
If the porblem still occurs for you please, provide a complete demo, wehre the problem could be reconstructed.


#8

hi semantik

after using mygrid.load(), I was returning header in the server response. Due to this filter text element were disappearing. Hence your suggestion resolved my issue.
thanks