OlegK

Forum Replies Created

Viewing 15 replies - 16 through 30 (of 968 total)
  • Author
    Replies
  • in reply to: Resizing ColumnChooser dialog #102286
    OlegK
    Participant

    Hello Tony,

    I uploaded here the current version of columnChooser which I use. It is based on the current version of columnChooser on jqGrid. The changes are following

    • variables are defined at the beginning of the functions
    • functions are declared before there will be used (for example function call)
    • function insert always return a value: return perm; is inserted at the end of the function
    • unneeded quotes are removed from all object properties in the code. For example the code opts = $.extend({“width” : 420,…}); are replaced to opts = $.extend({width : 420,…});
    • testing for if($.ui) {if ($.ui.multiselect ) {…}} are simplified. Unneeded test for opts.msel === “multiselect” are removed because the same name of multiselect pluging can have another name opts.msel. For example to solve problem with the same name of both jQuery UI Multiselect Widget and another from http://www.erichynds.com/blog/jquery-ui-multiselect-widget one have to use $.widget.bridge and in the case one need use opts.msel with the name other as “multiselect”.
    • parameter opts of the function dlog_opts are renamed to options. The variable opts are already used in outer scope. The usage of two different variables having the same name in the same code fragment make the code more complex to read.
    • some additional code are added at the end of columnChooser and as resize callback of the function dlog_opts. The code implements resizing of multiselect lists of dialog (from the content of the dialog) on resizing of the main Column Chooser dialog.

    Short comment to the resizing code. The original structure of content of the Column Chooser dialog looks like on the picture

    divs

    If we start from the .ui-dialog-content then

    • >div>select – internal hidden select list with the attribute multiple=”multiple”. It will be used internally. It’s hidden and don’t need be resized
    • >div>div.ui-multiselect – the div with main information
    • >div>div.ui-multiselect>div.selected – the left part of the dialog with the header and the list of visible columns
    • >div>div.ui-multiselect>div.available – the right part of the dialog with the header and the list of hidden columns
    • >div>div.ui-multiselect>div.selected>div.actions – the header of the list of visible columns
    • >div>div.ui-multiselect>div.selected>ul.selected – the list of visible columns
    • >div>div.ui-multiselect>div.available>div.actions – the header of the list of hidden columns
    • >div>div.ui-multiselect>div.available>ul.available - the list of hidden columns

    The code which I added in columnCooser at the end of the method changes CSS inline settings of the most above dives so that there have height: 100%; width: 100%; margin: auto. CSS of the right and the left pains (>div>.ui-multiselect>.selected and >div>.ui-multiselect>.available) will be set to width: 50%; box-sizing: border-box (width value will be calculated based on dividerLocation). After that the most elements of the dialog will be resized automatically correctly. One will just adjust the hight of ul elements (>div>div.ui-multiselect>div.selected>ul.selected and >div>div.ui-multiselect>div.available>ul.available). I did it inside of resize callback of the function dlog_opts.

    The demo uses the code of new column chooser. Additionally is demonstrates usage of setColWidth method (see the answer and here). Tony you can include the method in the main code of jqGrid if you want. Additionally the demo demonstrates autosizeColumns function which works slowly, but it allows to set column widths based on the width of maximal content in the column and the column header. The requirement will be frequently asked. Probably the code could help other people.

    Best regards
    Oleg

    P.S. I don’t tested the resizing code in old versions of web browsers. If the tests will show some problems in the browsers I would suggest to add if(old browser) return to skip resizing code. In the way one will have correct resizing in new web browsers and one will have old (non-resizable) Column Chooser dialog in old browsers.

    in reply to: delete with ‘id’ no matter which is the key on the Grid #102284
    OlegK
    Participant

    It’s not a bug. jqGrid send always rowid parameter as id parameter. See the documentation. On the other side jqGrid provide you prmNames option which almost you to rename almost all parameter which will be sent by jqGrid to the server. By usage prmNames: { id: “myId” } will rename the id name used during editing (delete too) to myId.

    One other thing, in small code fragment which you posted, looks not good: you use name having special meta-charackter “.” (see here). It’s not good. I would recommend you better to use name value which have no dots, spaces and other. Instead of that you can use typically jsonmap to read input JSON data, but you can still use name with more better value. Exact implementation could depends on other parameters which you use in jqGrid and from the exact format of input data. Just try to use

    Best regards
    Oleg

    in reply to: setting searchOperators of filterToolbar for column #102271
    OlegK
    Participant

    Hi Tony,

    it seems to me that the CSS rules

    can fix the jQuery UI compatibility problems which I described in the previous post.

    Best regards
    Oleg

    P.S. The pull request contains the changes.

    in reply to: JQGrid 4.5.4 – Column Chooser Bug #102249
    OlegK
    Participant

    I can confirm the bug. It’s important to mention that the problem don’t exist if one uses old versions of jQuery (for example 1.8.3) and old version of jQuery UI (for example 1.8.24). I prepared the demo which uses the old versions of jQuery and jQuery UI and it seems to work without any problems.

    Then I get the last version of jQuery UI Multiselect plugin from github and made some small changes to use [selected] selector. I changed two lines of jqGrid code too to do the same. As the result the code seems to work for both new jQuery (1.11.1) and new jQuery UI (1.11.0): the new demo. It’s important to remark that the demo which uses modified ui.multiselect.js and modified jqGrid works with old versions of jQuery (1.8.3) and jQuery UI (1.8.24).

    The modification which I made in jqGrid was replacing the line

    to the line

    and replacing the line

    to the line

     In the same way I modified the line 

    of ui.multiselect.js to the following line

    and another lines 

    to the lines

    One can get the modified version of ui.multiselect.js here.

    Best regards
    Oleg

    in reply to: improving performance of loading local data in jqGrid #102238
    OlegK
    Participant

    I modified the demo: the original and “the improved”. Different web browsers shows different time, for example

    IE11: original about 830, improved about 160, 

    IE10: original about 600, improved about 120,

    Chrome 37.0.2062.103: original about 1050, improved about 130

    In all tests the “improved” version worked noticeably quickly.

    About your comment rather the problem is jQuery problem or jqGrid problem. I see the problem so. If jqGrid are used with data input parameter it’s not really required to make deep copy of it. My demos shows, that making deep copy of a array parameter could take relatively many time. The only parameter which can be really large is data parameter. If jqGrid will don’t use it in $.extend(true,{…}) then the code could be just more quickly. So I see the suggested change as performance optimization in jqGrid and not as workaround of some jQuery bug. One can suggest a lot of optimizations in jqGrid code, but the most from there will improve performance in less then 0,1%. What I suggest can improve loading of large grid in multiple times just by removing some operation (deep copy of data parameter) which are not really required for jqGrid.

    Best regards
    Oleg

    P.S. I posted the pull request with the suggestions.

    in reply to: Edit and Add not working simultaneously #102223
    OlegK
    Participant

    I want to add for better description of the problem that in case of jqModal: false jqGrid just add every time new Add/Edit form with the same ids and then shows the first form (because of usage of id selector in $.jgrid.viewModal / $.jgrid.hideModal which find the first element on the page with the id). As the result the HTML representation of grid after one click on Edit and another Click on Add look like

    After repeat of Edit and Add clicks one will have 4 forms with the same id and so on:

    So it’s definitively a bug in jqGrid.

    One more small problem in jqGrid in case of is the font-size value. The font size in the form will be specified by 

     CSS rule (see the line of ui.jqgrid.css). On the other size the rule will be overwritten by CSS rule

     of jQuery UI (see here). To fix the problem one should add additional CSS rule to ui.jqgrid.css:

    I hope that Tony will read the thread and will make the reported problems (recreateForm: true don’t remove old form, jqModal: false creates forms with id duplicates and opens always the first form, incorrect font-size in editing form in case of jqModal: false)

    Best regards
    Oleg

    in reply to: Edit and Add not working simultaneously #102220
    OlegK
    Participant

    It seems to me that it’s really a bug in jqGrid. I will post later details. As a workaround I suggest to remove

    option from editing options. One of the reason of the problem is that jqGrid 4.5.4 (previous version, before 4.6) had the lines 

    which are removed from jqGrid 4.6 because of some reasons. So recreateForm option don’t really work in jqGrid 4.6.

    An alternative workaround would be to add beforeInitData callback in jQuery.jgrid.edit which would remove the previous created Edit/Add form:

    Best regards
    Oleg

    in reply to: Edit and Add not working simultaneously #102218
    OlegK
    Participant

    If you use default options of jqGrid or use recreateForm: true only for Edit and not for Add then jqGrid works as following

    If the user clicks Edit button the Edit form will be created. On closing the Edit form the form will be not destroyed, it will be just hidden (see here).

    If the user clicks Add button later jqGrid test the recreateForm option of Add operation. If it’s true then the previous created Add/Edit form will be destroyed (just some form options will be saved before see the lines).

    In general jqGrid try to modify Edit Form to Add form, but it works not always because of different reasons. So I personally recommend everybody to use recreateForm: true.

    Do you tried the line

     which I posted in one of my previous posts? Is the problem fixed now?

    Best regards
    Oleg

    in reply to: Edit and Add not working simultaneously #102216
    OlegK
    Participant

    You still don’t answer on my previous questions:

    The code which you posted contains exact the same Add and Edit options. So which problem you have exactly? How you see the differences?

    Moreover you used recreateForm: true only for Edit and not for Add options. Setting of jQuery.extend(jQuery.jgrid.edit, {…}); would be more logically to do before navGrid.

    Regards
    Oleg

    in reply to: Edit and Add not working simultaneously #102214
    OlegK
    Participant

    You still posted fragments of the code (the order could be important too for example). The code which you posted contains exact the same Add and Edit options. So which problem you have exactly? How you see the differences?

    To be sure that the problem is do not recreateForm problem I would recommend you to try to replace navGrid call which you posted to the following

    I recommend you additionally to rewrite the code of serializeEditData. The current code is very dirty. Instead of appending elem in the way like you do you can use for example onclickSubmit callback

    and uses just 

    regards
    Oleg

    in reply to: Edit and Add not working simultaneously #102212
    OlegK
    Participant

    First of all you should always post more details about what you do. Which editing mode you use (form editing, inline editing, cell editing) and in which form (inline editing for example can be used by direct call of editRow, by usage inlineNav or by usage of formatter: “actions”).

    If you use form editing for example then you can solve your problem probably by adding recreateForm: true option for both Add and Edit options.

    Best regards
    Oleg

    OlegK
    Participant

    Probably you posted in the wrong forum. jqGrid is jQuery plugin written in JavaScript. It’s open source and can be downloaded from trirand.com. There are some commercial solutions like from trirand.net for example. To understand the products good you still should have the knowledge of original JavaScript library, but you do many things in C# (or ASPX). You should read the corresponding documentation (like “Searching (Filtering) data” part of the documentation). In any way you should post your questions to the correct forum (for example here) and not in the current one.

    in reply to: multiple checkbox in SearchDropDown(search for multiple value) #102205
    OlegK
    Participant

    Hi!

    You can use some jQuery plugins or jQuery UI Widget to implement your requirement. One initialize the custom control/plugin/widget typically by calling some dataInit callback of searchoptions in the corresponding column of colModel.

    Take a look in my old answers, which provides demos using jQuery UI MultiSelect Widget (get here the last version): this one, this one and another one.

    Another way will be to use select2 plugin with the option multiple: true. It have another interface, but it can be used to implement multiselect too.

    Best regards
    Oleg

    OlegK
    Participant

    Hello Tony,

    I posted the improved pull request which fix the problem.

    Best regards
    Oleg

    in reply to: Resizing ColumnChooser dialog #102067
    OlegK
    Participant

    I posted before the suggestion (see the answer too) which describe how to make columnChooser resizable. The code still work. You can just include the code starting with $.jgrid.extend({columnChooser :function(opts){… from the answer and include the code fragment after jquery.jqGrid.min.js. In the way you will replace the original code of columnChooser with resazable version of it.


    @Tony
    : probably one could do modify the original code of columnChooser  in the way? I use the code in all my grids more as two years and I didn’t found any problem with the modified code which I suggested.

    Best regards
    Oleg

Viewing 15 replies - 16 through 30 (of 968 total)

Stay connected with us in your favorite flavor!