0

Need a help on this please... I just now upgraded to free-jqgrid 4.13.6. Earlier I was using jqgrid 4.3

I am using below code and I see below as it is in picture. The difference here is in the first colModel (Review) I am using formatter: "select". In this case I am getting the value as "No" or "Yes". But when there is a null value, I am getting "undefined".

In second column (Status), I am NOT using formatter: "select". Here I am getting the value as "Y" or "N" and getting blank when it is null.

But I need the value to display as Yes/No and blank when the value is null.

Note: It was working fine in jqgrid 4.3

enter image description here

{name:'Review', width:85, fixed: true, align:'center', sortable: false, search: false, editable: true, resizable: false, stype:'select', formatter: "select", 
     edittype:'select', editoptions:{
         value:'Select:Select;Y:Yes;N:No',
         defaultValue:'Intime',
         multiple: false
     },
      searchoptions: {
         sopt: ['eq','ne'],
         value: 'Y:Yes;N:No',
         attr: {multiple: 'multiple', size: 2},
         dataInit: dataInitMultiselect
     }
 },
{name:'Status', index:'confirmationStatus', sortable: false, search: false, width: 80, fixed: true, align:'center', resizable: false, editable: true, stype:'select', 
     edittype:'select', editoptions:{
         value:'Select:Select;Y:Yes;N:No',
         defaultValue:'Intime',
         multiple: false
     },
     searchoptions: {
         sopt: ['eq','ne'],
         value: 'Y:Yes;N:No',
         attr: {multiple: 'multiple', size: 3},
         dataInit: dataInitMultiselect
     }
},
SK.
  • 1,390
  • 2
  • 28
  • 59
  • Which values could be in the columns? Why you use `defaultValue:'Intime'` and `value:'Select:Select;Y:Yes;N:No'` instead of `value:Y:Yes;N:No'`? Which `dataInitMultiselect` you use? Do you use `ui.multiselect.js` from `plugins` folder of jqGrid? – Oleg Feb 14 '17 at 18:34
  • Honestly, I don't have idea about defaultValue:'Intime'. I just found the code which is already there. Same for value:'Select:Select;Y:Yes;N:No'. We are using Eric Hynds' multiselect – SK. Feb 14 '17 at 18:49
  • Looks like value:'Select:Select;Y:Yes;N:No' has been used to show "Select" also in the drop down. fyi: this is not a multiselect drop down. – SK. Feb 14 '17 at 18:50
  • But I am wondering it has been working with jqgrid 4.3. Now I am upgrading to free-jqgrid 4.13. and it stopped working... – SK. Feb 14 '17 at 18:51
  • I rewrote large parts of jqGrid code to improve the performance and to implement many new feature. Some bugs in old code will be not ignored in the new versions of free jqGrid. – Oleg Feb 14 '17 at 18:53
  • Do you tried to use `{name:'Review', template: "booleanCheckbox"}` instead of all your existing settings of `Review` column? Do you uses Font Awesome CSS now in your code? – Oleg Feb 14 '17 at 18:57

1 Answers1

0

You should fix the defaultValue:'Intime' in the column Review. You have to use the value, which is inside of values, which you define in value. I suppose it should be defaultValue:'N'.

I'd recommend you to take a look in the issue, where I describe some new features of the next version of free jqGrid, which you load already from GitHub. It uses sopt: ["in"]

stype: "select", 
searchoptions: {
    generateValue: true,
    //noFilterText: "Any",
    sopt: ["in"],
    attr: {
        multiple: "multiple",
        size: 4
    },
    dataInit: dataInitMultiselect
}

Try https://jsfiddle.net/OlegKi/3oeatxur/6/

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • beautiful. removed this code and it worked as I wanted to. Thanks a ton... defaultValue:'Intime' . I still have a lot to learn and have many questions, not sure I could ask... there is a limit is stackoverflow that I can post only one question in 3 hours... Now in the same grid I am trying to do select all (the check box at the top left cornor of the grid, multiselect: true). but I don't want to edit the rows, only want select. I already did that. But I have a button outside the grid. on click of that button I want to edit all selected rows and update a value to a particular column – SK. Feb 14 '17 at 19:08
  • @SKumar: You are welcome! It would be more productive if you would prepare small demos in JSFiddle, which demonstrates your existing problem. I could modify your code to demonstrate how one can fix it. – Oleg Feb 14 '17 at 19:11
  • I really love JSFiddle. but is blocked here. that is why I myself is also not able to see many answers. So for the above query, I have tried below code but it is really slow when the number of rows goes beyond 100. And user doesn't want pagination – SK. Feb 14 '17 at 19:14
  • $( "#UpdateReviewButton" ).on('click', function() { var newReviewValue = // get value from another text box var selectedRows = $('#myGrid').jqGrid ('getGridParam', 'selarrrow'); if (selectedRows.length > 0) { for (var i=0, il = selectedRows.length; i < il; i++) { var selectedRow = selectedRows[i]; $('#myGrid').jqGrid('editRow', selectedRow, true); $("#"+ selectedRow +"_review").val(newReviewValue); } } }); – SK. Feb 14 '17 at 19:14
  • @SKumar: Sorry, but I don't understand the sense of the code. Why you start editing of all the selected rows. You can just use `$('#myGrid').jqGrid(setCell, selectedRows[i], "review", newReviewValue);` instead of starting of inline editing of all the lines. What should be the goal of the code? – Oleg Feb 14 '17 at 19:19
  • @SKumar: The usage of large grids without local paging is really bad idea. It makes the grid working 100-1000 times slowly without any clear advantage for the user. Everybody can intuitively understand local paging now. It makes reaction of the grid with 10000 rows works practically immediately. I repeat [the example](http://www.ok-soft-gmbh.com/jqGrid/OK/performane-15-60000-25-free-jqgrid.htm) with 60000 rows and 10 rows per page. The demo displays the time of paging, sorting and filtering. – Oleg Feb 14 '17 at 19:23
  • The goal is to make it editable (inline edit), so that the user can hit different buttons (for example here it is UpdateReviewButto, there are other as well, like "statusButton", "priorityButton") to update for selected rows in one go (that means mass edit of a column in one button click). And to make and keep it editable, because user can change one or few columns manually (means if I clicked the status button for 100 rows to change the value to "Completed", but now I changed mu mind to change to "In Progress" for 5 of those (already selected and changed to "Completed", so I can change that. – SK. Feb 14 '17 at 19:27
  • in this application, we are expecting maximum 300 rows at one time... may be because of that they didn't want pagination – SK. Feb 14 '17 at 19:29
  • Do you know what is [web browser reflow](https://developers.google.com/speed/articles/reflow)? It's important to understand that if you have 300 rows on the page with 20 columns then you have more as 6000 elements on your HTML page. If you, for example, modify **one element** on the page then the web browser have to *recalculate* or really *change* the postition of **all 6000** elements. By starting editing of one row you change all editable cells, for example 10, in the row. The complexity of the operation is 10*6000. If you start editing of 10 rows than you have complexity 600000. – Oleg Feb 14 '17 at 19:34
  • If you want to force the user to review some set of rows you should first **filter** the grid to display only the rows, which should be edited and then to edit the rows. It increases essentially the performance of the page. – Oleg Feb 14 '17 at 19:38
  • Yes, I understand the pain... :) but this is how the application is. At least I am able to upgrade the IE compatiblity mode to Edge. Earlier it was 5. At this point of time, I am not to convince users to implement pgaeination. So just trying to improve the performance. – SK. Feb 14 '17 at 19:39
  • It's you coice, but if you say that you can improve the performance of some operation in 1000 times, nobody will answer you "no". Local paging is the simples way to improve the performance. – Oleg Feb 14 '17 at 19:41
  • I am really sorry if I said something wrong. but here I am on fire... is there any other efficient way to edit multiple rows at one time. Say 100 rows with 5 editable column and 5 non-editable columns ? – SK. Feb 14 '17 at 19:50
  • Yes of cause, if you **don't modify** the content of the grid and it **contains** already checkboxes or selects **at the beginning**. You have to modify *local* data if the user change the selects or chechboxs. – Oleg Feb 14 '17 at 19:54
  • I am sorry, I could understand what do you mean by "modify local data if the user change the selects or chechboxs" – SK. Feb 14 '17 at 19:58
  • @SKumar: try [the demo](http://www.ok-soft-gmbh.com/jqGrid/EditableCheckbox.htm), which I created for [the answer](http://stackoverflow.com/a/24239416/315935). It uses `formatter: "checkbox", formatoptions: { disabled: false}`. The chechboxs exist **at the loading time**. Additionally the local data will be immediately modified if the user chack/uncheck a checkbox. You can modify some checkboxes on one page, go to the next page and go back. You see that the state of chexhboxes (the state in the local `data`) always corresponds the state of checkboxs which the user see. – Oleg Feb 14 '17 at 20:03