I have a jqGrid with code similar to following sample code:
jQuery("#list10").jqGrid({
url:'MyServlateName?action=MyAction',
datatype: "xml",
mtype:"POST",
ajaxSelectOptions: {type: "POST"},
sortable: true,
height: "100%",
rowNum:4,
width: 1000,
emptyrecords: "No Records to display",
colNames:['Contact No', 'Cust ID', 'Name'],
colModel:[
{name:'CNO',index:'CNO', width:80,sortable:true},
{name:'CUSTID',index:'CUSTID', width:60,sortable:true},
{name:'CNAME',index:'CNAME', width:200,sortable:true, searchoptions:{ sopt:['cn']}},
],
pager: '#pager10',
viewrecords: true,
sortname: 'CUSTID',
shrinkToFit: false,
toppager: true,
sortorder: "asc"
}
}).navGrid('#pager10',{cloneToTop:true, edit:false,add:false,del:false,view:true,search: false, refresh:true},
{},
{},
{},
{},
{recreateForm: true,width:700,navkeys: [true,38,40]}
);
jQuery("#list10").jqGrid('bindKeys');
$("#list10").jqGrid('filterToolbar', {stringResult: true,searchOnEnter: false});
In filterToolbar I am putting CUSTID programmatically using following code:
document.getElementById("gs_CUSTID").value=CUST_ID_VAR_NAME;
It is showing the value in filterToolbar in CUSTID column but grid is not populated/searched according to the CUSTID I have put(NO SEARCH HAPPENS). If I do regular search using filterToolbar then it works fine.
Any suggestion will be appreciated.
You can fix the problem in different ways. For example you can trigger change event on #gs_CUSTID after setting the value in the control:
$("#gs_CUSTID").val("123");
$("#gs_CUSTID").trigger("change");
More better will be to set datatype: "local" initially in the grid. It will prevent loading of unfiltered data from 'MyServlateName?action=MyAction' during creating the grid. After that you can change datatype to "xml" using setGridParam, set value in #gs_CUSTID and trigger the change event at the end.
$("#list10").jqGrid("setGridParam", {datatype: "xml"});
$("#gs_CUSTID").val("123");
$("#gs_CUSTID").trigger("change");
Instead of triggering change you can call triggerToolbar method manually (see the part of jqGrid code):
$("#list10").jqGrid("setGridParam", {datatype: "xml"});
$("#gs_CUSTID").val("123");
$("#list10")[0].triggerToolbar();
Related
I have below given sampleMeasurement1; I want to update values of respective columns in InfluxDB. How to update those values?
SELECT * FROM sampleMeasurement1;
{ "results": [ { "series": [ { "name": "sampleMeasurement1", "columns": [ "time", "disk_type", "field1", "field2", "hostname" ], "values": [ [ 1520315870774000000, null, 12212, 22.44, "server001" ], [ 1520315870843000000, "HDD", 112, 21.44, "localhost" ] ] } ] } ] }
We can't change tag values via InfluxDB commands, we can however write a client script that can change the value of a tag by inserting "duplicate" points in the measurement with the same timestamp, fieldset and tagset, except that the desired tag will have its value changed.
Point with wrong tag ( https://docs.influxdata.com/influxdb/v1.4/write_protocols/line_protocol_reference/#syntax ):
cpu,hostname=machine.lan cpu=50 1514970123
After running
INSERT cpu,hostname=machine.mydomain.com cpu=50 1514970123
a SELECT * FROM CPU would include
cpu,hostname=machine.lan cpu=50 1514970123
cpu,hostname=machine.mydomain.com cpu=50 1514970123
After the script runs all the INSERT commands, you'll need to drop the obsolete series of points with the old tag value:
DROP SERIES FROM cpu WHERE hostname='machine.lan'
Change tag value in InfluxDB
I am using fusion chart in my application.I am taking json array from servlet to javascript.
Code :
var customerCountList=response.sharecountlist;
FusionCharts.ready(function(){
var revenueChart = new FusionCharts({
type: "column3d",
renderAt: "spraybookerCount-bar",
width: "500",
height: "300",
dataFormat: "json",
dataSource: {
"chart": {
"caption": "Revenue for last year",
"palettecolors": "e44a00",
"subCaption": "Harry's SuperMart",
"xAxisName": "refvalue",
"yAxisName": "['viewcount']",
"theme": "carbon"
},
"data"://here i want to use response.sharecountlist
}
});
revenueChart.render("spraybookerCount-bar");
});
here sharecountlist is sharecountlist==[{"viewcount":99,"refvalue":"Guest"},{"viewcount":4,"refvalue":"facebook"},{"viewcount":2,"refvalue":"friend"}].
sharecountlist is dynamic ,so how can I use this sharecountlist in place of data in above code. Please help me.
Thanks.
i'm having a problem with jqgrid searching. my code works perfectly with add, edit, delete except searching. Once I load it the data shown fine, but if I click find button, it never does anything.
I have been looking for it everywhere but I can't find what's wrong. If I use loadonce : true then searching works but now having problem with paging and sorting the grid. I wanna make it work perfectly with paging, sorting, and searching.
here's my code.
$("#material_list").jqGrid({
url:"MY URL",
editurl:"MY URL",
mtype:"post",
caption:"LIST",
datatype:"json",
height:"auto",
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: true
},
rowNum:10,
rowList:[5,10,15],
colNames:["PROD_CODE","PROD_NAME","COMP_CODE","UNIT","STANDARD","USEFLAG"],
colModel:[
{name:"PROD_CODE", index:"PROD_CODE", editable:true},
{name:"PROD_NAME", index:"PROD_NAME", editable:true},
{name:"COMP_CODE", index:"COMP_CODE", editable:true},
{name:"UNIT", index:"UNIT", editable:true},
{name:"STANDARD", index:"STANDARD", editable:true},
{name:"USEFLAG", index:"USEFLAG", editable:true}
],
pager:"#pager",
autowidth:true,
viewrecords:true,
//loadonce:true,
});
$("#material_list").jqGrid(
"navGrid",
"#pager",
{search:true, edit:true, add:true, del:true},
{closeAfterEdit:true, reloadAfterSubmit:true},
{closeAfterAdd:true, reloadAfterSubmit:true},
{reloadAfterSubmit:true}
);
i'm new in ExtJS and Servlet.
I created a form with 2 fields usinf ExtJS :
var panel = Ext.create('Ext.form.Panel',
{
title: 'Personnal Data',
bodyPainting: 5,
width: 350,
region:'center',
url: 'save_form.php',
items:
[{
xtype: 'textfield',
fieldLabel: 'First Name ',
name: 'firstName'
},
{
xtype: 'textfield',
fieldLabel: 'Last Name ',
name: 'lastName'
}],
buttons:
[{
text: 'Submit',
handler: function()
{
var formData = this.up('form').getForm();
}
}]
});
But i don't know how to pass the value of the two fields to a servlet, by clicking on the button.
And how can i retrieve the data entered in the form, in the servlet ?
Thank you !
By default ExtJS Forms will send over the values in an "ajax" fashion and I believe it will be a "post". In your servlet (assuming you are posting to a servlet defined in your web.xml file) in your doPost (or doGet) methods, use the "request" variable in the method and do
request.getParameter("firstName")
and
request.getParameter("lastName")
.
Link to HttpServlet Definition (is the same for just about every java container).
Edit:
In your handler you need to add:
formData.submit();
I have nameProperty set in the proxy of my store like this :
Code:
writer : {
type : 'json',
nameProperty : 'mapping',
root : 'PerVO'
}
And in my model , the mapping like this:
{
name : 'modules',
mapping : 'modules.collection',
defaultValue: []
},
This works fine when I call the CRUD operations on the store. Now I want to get the data in the format being sent to the server for other operations. The problem is that when I get the record from the store , the mapping is lost. So how can I useExt.data.writer.Json or some other api to generate the data EXACTLY as it would be generated while being sent to the server with mapping applied :
This is what the store sends for save (I need the data like this. Note : Difference is 'collection:')
"modules": {
"collection": {
"isActive": 1,
"metadata": {
"actionCodes": "",
"memos": ""
},
"moduleCode": "OM",
"moduleId": 250,
"moduleName": "Org Management",
"success": false,
"viewId": 0
}
},
This is what i get from the store when the record is looked up:
"modules": {
"isActive": 1,
"metadata": {
"actionCodes": "",
"memos": ""
},
"moduleCode": "OM",
"moduleId": 250,
"moduleName": "Org Management",
"success": false,
"viewId": 0
},
I need to get the data as sent by the store to server.
Thanks
Nohsib
Simply change the name in the mapping to the following
{
name : 'collection',
mapping : 'modules.collection',
defaultValue: []
}
The name config is the name that is used within the model. If you look at the data property of a model object, the name used in the mapping is used to store the value in the model. The name is same name that we use while retrieving data from a model object too. Ex. model.get(name);
From the api.
The name by which the field is referenced within the Model