ignoreCase sorting is not working on column - javascript

In Jqgrid my column is as below,
{name : 'name',editable:true,width:120,sorttype:'string'},
but it provides case sensitive sorting as below.
- product Sales Agent
- email Queue
- default Queue
- Trouble Ticket
- Billing & Payment
I tried with ignoreCase:true also but it does not work.
I need sorting to be done by ignoring case as shown below,
- Trouble Ticket
- product Sales Agent
- email Queue
- default Queue
- Billing & Payment
Any idea how this can be possible ?
colNames:['questionId','Name','Answer','Show','Edit','Option'],
colModel : [
{name : 'questionId',sorttype:'int',align:'left',editable:true, hidden:true},
{name : 'name',editable:true,width:120,sorttype:'text',ignoreCase:true,soratble:true}, {name : 'answer',align:'left',width : 400,sorttype:'string',editable:true},
{name : 'enable',align:'center',width : 60,sorttype:'string',editable:true, formatter : formatEnable},
{name : 'edit',editable:false, formatter:addEditButton,align:'center',width:50},
{name : 'feedbackOptions.optionId',editable:false, align:'center', hidden:true},
],
jsonReader : {root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false
},
multiselect : true,
height: '170px',
paging : true,
emptyrecords : "<spring:message code='label.norecords'/>",
viewrecords : true,
rowNum : 10,
rowList : [10,20,30],
pager : "#pager",
loadonce : true,
footerrow : false,
userDataOnFooter : true,
altRows : true,
loadonce:true,
loadComplete: function (data) {
$('#buttonDiv').show();
}
});
jQuery("#list").jqGrid("navGrid","#pager",{del:false,add:false,edit:false, search:false, refresh:false});
},
error:function(xhr,ajaxoptions,thrownError){
}
});
}

Try to change sorttype:'string' in sorttype:'text'.

Add IgnoreCase: true to the options of jqgrid instead of the column.

if you are using 3.8 version of jqGrid. try to change as follows on grid.base.js
Make _usecase field to false and try.
from : function(source){
....
_usecase=false,
}
The same issue been resolve on the later version hence no need to change over there.

I know this is an old question, but I dropped here by accident while working. How if you try in your column like this?
Your column right now (or wherever the question was written):
{name : 'name',editable:true,width:120,sorttype:'text',ignoreCase:true,sortable:true}
The column with ignoreCase function using some JS trick:
{name:'name', editable:true, width:120, sortable:true, sorttype: function(cell,obj){
return cell.toLowerCase()}
};
Notice cell contains the String value of the cell, so you have to work with that when you want to order the elements inside the jqGrid.
Hope it helps

Related

Adding a checkbox column shows error : "Requested unknown parameter '0' for row 0, column 0"

I need to add a new column to show a checkbox for further table operations, and i'm constantly getting the "Requested unknown parameter '0' for row 0, column 0.”
Previously, the datatable's code was like this (And it worked with no errors) :
tabla = $('#table').DataTable({
/** Default Configuration, it is read from a file but i'll show some of the values in case it is needed for a better understanding of the problem **/
destroy: true,
pagingType : "full_numbers",
paging : true,
lengthChange : true,
lengthMenu : /*Array*/,
pageLength : 25,
serverSide : true,
ordering : false,
searching : true,
processing : true,
deferRender : true,
fnDrawCallback : configDefectoDatatables.fnDrawCallback,
/** AJAX **/
ajax : {
beforeSend: beforeSend,
url : urlAjax,
type : "POST",
timeout : 50000,
error : errorNotificationFunction
},
/** Column Definition **/
columns : [ {
class : "idClass",
data : "id",
defaultContent : "",
targets : 0
}, {
class : "requestClass",
data : "request",
defaultContent : "",
targets : 1
},
/**Some other columns with the same format **/
{...}]
My attempt was creating a new <th> before the others to the HTML file, and adding the following column as the new '0' (And moving the other column's targets one position upwards)
This does indeed show the checkbox on every row, and enables the multiple selection feature, but it still shows the mentioned error
{
orderable: false,
className: 'select-checkbox',
targets: 0
}
And also, the required select property as follows
select: {
style: 'multi',
selector: 'td:first-child'
}
I was trying some random nonsense and found that adding a data : null made the error disappear, but added a new problem (it shows an [Object object] and the checkbox on top of it)
{
orderable: false,
data : null,
className: 'select-checkbox',
targets: 0
}
I know it may (and probably will) be a simple problem due to my lack of knowledge of the technology but i'm not getting any solution by myself.
Okay, so, this may not be the best solution, but simply setting the column like this fixed the error
{
data : null,
defaultContent : "",
className : 'select-checkbox',
targets : 0
}

setValue() not work corectly in combobox with pagination sencha

I have combobox with pagination inside:
var itemsSelect = Ext.create('Ext.form.ComboBox', {
id : 'itemsControllerSelect',
emptyText : 'not found',
pageSize: true,
store : {
type : 'store',
autoLoad: true,
pageSize: 4,
proxy : {
type: 'api',
url : SITE_URL + '/api/items'
}
},
triggerAction: 'all',
displayField : 'name',
valueField : 'id'
});
When I set value for edit using Ext.getCmp('itemsControllerSelect').setValue(5);
Inside combo displayed id item, but I want to display name.
If I set value using id witch is on first page all work corecctly.
I think the problem is that I do not have this item in store because item with this id is only second page in pagination.
How can I resolve this problem?

Change xtype combo to lovcombo EXT JS 2

I currently have a list with support products which shows me the names of the support products. What I want to do is that from that combo you can choose more than one value. I tried with lovcombo but it does not work for me.
I appreciate your help
xtype : 'combo',
fieldLabel: this.i18n.fieldProdApoyo,
hiddenName : 'fovaFisioProdApoyo',
displayField: 'mateNombre',
valueField : 'mateId',
typeAhead : true,
emptyText: this.i18n.comboProductosEmptyText,
forceSelection: true,
titleCollapse: true,
triggerAction: 'all',
store: new Ext.data.JsonStore({
url : ctx + '/material.do',
autoLoad : true,
remoteSort : false,
baseParams : {
op : 'listCombo'
},
sortInfo : {
field : "mateNombre",
direction : "ASC"
},
fields : ['mateId', 'mateNombre']
})
Try multiSelect:true; in that combo. Remember that it will work with 'Ctrl' press when you select more than one value.

ExtJs 3.4 : Concatenate selected value of a combo into a label text

I have an Ext combo box in a form panel as following.
new Ext.form.ComboBox({
store : routeStore,
displayField : 'rName',
valueField : 'rName',
fieldLabel : 'Select Fixed Route',
id : 'routeCombo',
typeAhead : true,
forceSelection : true,
mode : 'local',
triggerAction : 'all',
selectOnFocus : true,
editable : true,
hidden : false,
disabled : true,
minChars : 1,
hideLabel : true,
width : 210,
emptyText : 'Select Fixed Route'
})
An also I have a label like this.
{
xtype : 'label',
id : 'idTourCode',
text : 'SystemDate',
forId : 'myFieldId',
style : 'marginleft:10px',
//autoWidth : true,
flex : 1
}
Now I need to concatenate the selected value of the combo box to my label text. This label already has a text. What I want is, the selected value of the combo should be concatenate to this label text. All of these things should be happen on a button click.
I've tried to find a solution but no luck. Therefore, please be kind enough to help me to clarify my problem.
Thanx a lot
This is a crude fix.
Add this to your combobox:
listeners: {
change: function(box, newValue)
{
Ext.ComponentQuery.query("#myLabel")[0].setText(newValue)
}
Add this to your label:
itemId: 'myLabel'
You should polish this a bit and find a better to access you combobox than Ext.ComponentQuery, because it is really slow.

Colours disappear after resort jqGrid

When css attributes are set during initialization it works fine, colours and backgrounds in cells also change when initiated from a function. But when I sort the columns all colours set from function disappear and go back to the normal grid.
<script>
var Mydata =[
{
"id":"560058",
"nm" : "L 41971",
"temp" : "21.2",
"ignition" : "off",
"pos_x" : "55.2024832",
"pos_y" : "24.9640256",
"drv" : "",
"pos_s" : "0",
"param24" : "0",
"param240" : "0",
"pwr_ext" : "12.825"
},
{
"id":"560059",
"nm" : "L 41972",
"temp" : "21.2",
"ignition" : "off",
"pos_x" : "55.2024832",
"pos_y" : "24.9640256",
"drv" : "",
"pos_s" : "0",
"param24" : "0",
"param240" : "0",
"pwr_ext" : "12.825"
}
];
var grid = $("#live_view");
grid.jqGrid({
height: '100%',
width: '700',
datatype: "local",
loadonce: true,
data : Mydata,
gridview: true,
colNames: ['Name', 'Temperature', 'Ignition', 'lat', 'lon', 'Driver', 'Speed', 'param24', 'movement', 'pwr_ext'],
colModel:[
{name:'nm',index:'nm'},
{name:'temp',index:'temp'},
{name:'ignition',index:'ignition'},
{name:'pos_x',index:'pos_x'},
{name:'pos_y',index:'pos_y'},
{name:'drv',index:'drv'},
{name:'pos_s',index:'pos_s'},
{name:'param24',index:'param24'},
{name:'param240',index:'param240'},
{name:'pwr_ext',index:'pwr_ext'},
],
rowNum:100,
rowList:[100,200,300],
pager: '#pager2',
sortname: 'param240',
viewrecords: true,
sortorder: "desc",
caption:"Vertex Live View",
loadComplete: function() {
grid.jqGrid('setCell',"560058","nm","",color:'red'});
},
});
$("#live_view").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
$("#cc").click(function (){
$("#live_view").jqGrid('setCell',"560058","nm","",{color:'blue'});
})
</script>
Change Colour
When you sort, it recreates the html. For all jqgrid knows, the column you modified might not even be visible on the current page after sorting. Bottomline, you will need to reapply the colours.
You could peruse the jqGrid api, to see if they allow setting the colour of the cell from the model data. I don't think so though.

Categories

Resources