cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

advance grid search

Harsha11
6-Contributor

advance grid search

How Can I implement search functionality in Advance Grid, I have enabled the "Enable Grid Search" checkbox in the advance grid properties.

how can I configure so that I can start working?

please suggest if anyone has an idea

1 ACCEPTED SOLUTION

Accepted Solutions
Harsha11
6-Contributor
(To:mnarang)

Hi,

As you suggested, this is what I wrote:

 

var params = {
url: "http://localhost:8020/vecv_services/api/shop",
proxyPort: undefined /* INTEGER */,
password: "Mestech@6" /* STRING */,
domain: undefined /* STRING */,
contentType: "application/json;charset=UTF-8" /* STRING */,
username: "mestech" /* STRING */
};

// result: JSON
var json = Resources["ContentLoaderFunctions"].GetText(params);

var obj = JSON.parse(json);

var paramsDS = {
infoTableName : "InfoTable",
dataShapeName : "Shop_DS_Harsha"
};

var infoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(paramsDS);
var dt = obj.data

//for (var elem in json)
for (var i=0; i<dt.length; i++)
{
var row = dt[i];
var shopCodeVal = row.shopCode;
var shopNameVal = row.shopName;
var descriptionVal = row.description;
var plantNameVal = row.plantName;
var shopIdVal = row.shopId;

infoTable.AddRow({shopCode:shopCodeVal,shopName:shopNameVal,description:descriptionVal,plantName:plantNameVal,
shopId:shopIdVal});
}

//var result = infoTable;

var params = {
t: infoTable /* INFOTABLE */,
query: query /* QUERY */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Query(params);

 

and took query parameter in the input field and base type as infotable

 

but still its not working 

can you please help me??

 

 

View solution in original post

10 REPLIES 10
mnarang
17-Peridot
(To:Harsha11)

If you have enable the search option in advance grid ,then you can simply put the text which you want to search and that is available in grid .What do you mean my configuration after that ?

It is already configured ,just type the text in the search box and see the result in the grid .

 

I think i got your query in right fashion ,correct me if this is about something else .

 

 

Thanks,

Mukul Narang 

Harsha11
6-Contributor
(To:mnarang)

yes but when I am entering text under the search text box and hitting the enter button it is doing nothing..

So, I thought there may be some configuration required.

following are the steps I did:

1) Load the service from which data is coming.

2)took a advance grid over the mashup

3)drag data from the service

4)enable the search option

and when I run the mashup and enter the text inside the search textbox it is not searching text.

please correct me If I am doing anything wrong?

 

mnarang
17-Peridot
(To:Harsha11)

So after enabling the search option ,do these two things 

1) Map the filter event from grid properties to the service which is giving data to the grid 

2) Map the QueryFilter event from properties to "query" parameter of your service parameters option .(There are parameter in service click on (+) sign of that and there will be a query ,map QueryFilter to this query )

 

Let me know if you are able to search ant text after this .

 

Thanks ,

Mukul Narang

Harsha11
6-Contributor
(To:mnarang)

yes I tried the steps which you have mentioned,

but I am calling rest API for getting the data

below is my service and there is not any query parameter

var params = {
url: "http://lt-153:8020/vecv_services/api/shop",
proxyPort: undefined /* INTEGER */,
password: "Mestech@6" /* STRING */,
domain: undefined /* STRING */,
contentType: "application/json;charset=UTF-8" /* STRING */,
username: "mestech" /* STRING */
};

// result: JSON
var json = Resources["ContentLoaderFunctions"].GetText(params);

var obj = JSON.parse(json);

var paramsDS = {
infoTableName : "InfoTable",
dataShapeName : "Shop_DS_Harsha"
};

var infoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(paramsDS);
var dt = obj.data

//for (var elem in json)
for (var i=0; i<dt.length; i++)
{
var row = dt[i];
var shopCodeVal = row.shopCode;
var shopNameVal = row.shopName;
var descriptionVal = row.description;
var plantNameVal = row.plantName;
var shopIdVal = row.shopId;
// var bodyVal = row.body;
infoTable.AddRow({shopCode:shopCodeVal,shopName:shopNameVal,

description:descriptionVal,plantName:plantNameVal,
shopId:shopIdVal});
}


var result = infoTable;

So, please enlighten me how should I map QueryFilter to Query param?

 

thanks a lot for your instant replies 

 

Regards,

Harsha Joshi.

mnarang
17-Peridot
(To:Harsha11)

So basically you can add a query parameter to your infotable ,as i can see the code the final result is your infotable .So before returning the final infotable as result add a query parameter to the infotable and then return it in the code .And to add a query parameter you can write this code in the end (before returning the result )

 

var params = {

t: infoTable /* INFOTABLE */,

query: query /* QUERY */

};

// result: INFOTABLE

var result = Resources["InfoTableFunctions"].Query(params);

 

Let me know if you did not get it 

 

Thanks ,

Mukul Narang 

Harsha11
6-Contributor
(To:mnarang)

Hi,

As you suggested, this is what I wrote:

 

var params = {
url: "http://localhost:8020/vecv_services/api/shop",
proxyPort: undefined /* INTEGER */,
password: "Mestech@6" /* STRING */,
domain: undefined /* STRING */,
contentType: "application/json;charset=UTF-8" /* STRING */,
username: "mestech" /* STRING */
};

// result: JSON
var json = Resources["ContentLoaderFunctions"].GetText(params);

var obj = JSON.parse(json);

var paramsDS = {
infoTableName : "InfoTable",
dataShapeName : "Shop_DS_Harsha"
};

var infoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(paramsDS);
var dt = obj.data

//for (var elem in json)
for (var i=0; i<dt.length; i++)
{
var row = dt[i];
var shopCodeVal = row.shopCode;
var shopNameVal = row.shopName;
var descriptionVal = row.description;
var plantNameVal = row.plantName;
var shopIdVal = row.shopId;

infoTable.AddRow({shopCode:shopCodeVal,shopName:shopNameVal,description:descriptionVal,plantName:plantNameVal,
shopId:shopIdVal});
}

//var result = infoTable;

var params = {
t: infoTable /* INFOTABLE */,
query: query /* QUERY */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Query(params);

 

and took query parameter in the input field and base type as infotable

 

but still its not working 

can you please help me??

 

 

mnarang
17-Peridot
(To:Harsha11)

There is already a post on the same you can also refer to this -

https://community.ptc.com/t5/ThingWorx-Developers/Searching-for-entry-in-Advanced-Grid/td-p/530569

 

This also holds sample entities ,you can import them and see the sample for your use case .

 

If still you are not able to get it ,let me know .I will write a new sample and provide you .

Harsha11
6-Contributor
(To:mnarang)

Okay Thanks a lot for your help

 

Regards,

Harsha Joshi

mgoel
17-Peridot
(To:Harsha11)

Hi @Harsha11 Please mark this post Accept as solution so that it can be helpful for others in future.

Harsha11
6-Contributor
(To:mgoel)

Done.

 

Thanks for informing

Top Tags