2236
|
General Category / EasyUI for jQuery / Re: changing datagrid column title
|
on: June 12, 2014, 03:12:28 PM
|
To update and apply column properties, you have to recreate datagrid with the new columns. var dg = $('#dg'); var columns = dg.datagrid('options').columns; columns[0][2].title = 'new title'; //change columns ... dg.datagrid({columns:columns}); // recreate datagrid
|
|
|
2239
|
General Category / EasyUI for jQuery / Re: Confirmation dialog on panel onBeforeClose
|
on: June 09, 2014, 06:31:37 PM
|
All the $.messager functions work in async mode. This means that the user can't block it before doing any more. To make the confirm message window works like a native confirm window in 'onBeforeClose' event, please try the code below: $('#win').window({ onBeforeClose:function(){ var p = $(this); $.messager.confirm('Confirm','Are you sure you want to close?',function(r){ if (r){ var opts = p.panel('options'); var onBeforeClose = opts.onBeforeClose; opts.onBeforeClose = function(){}; p.panel('close'); opts.onBeforeClose = onBeforeClose; } }); return false; } })
|
|
|
2240
|
General Category / General Discussion / Re: last selected on combobox on reload
|
on: June 07, 2014, 05:44:42 AM
|
If a data item has 'selected' property set to true, it will be selected when loaded successfully. All you need to do is to set 'selected' property for the specified item from your returned json data. Look at the following data, the 'Ruby' item will be selected since its 'selected' property is set to true. [{ "value":1, "text":"Java" },{ "value":2, "text":"C#" },{ "value":3, "text":"Ruby", "selected":true }]
|
|
|
2242
|
General Category / EasyUI for jQuery / Re: automatic check/select data in datagrid
|
on: June 03, 2014, 07:50:23 AM
|
The 'checkRow' method must be called after loaded data successfully, so please do the checking rows in the 'onLoadSuccess' event. <table id="package_group_table" class="easyui-datagrid" style="width:250px;height:150px" data-options="url:admin/packagegroup/list_package_group_for_checkbox',singleSelect:false, onLoadSuccess:function(){ var rows = $(this).datagrid('getRows'); for(var i=0; i<rows.length; i++){ if (rows[i]['CHECKED']){ $(this).datagrid('checkRow',i); } } } "> <thead> <tr> <th data-options="field:'PACKAGE_GROUP_ID'">ID</th> <th data-options="field:'PACKAGE_GROUP_ALIAS'">Name</th> <th data-options="field:'CHECKED'">Status</th> <th data-options="field:'CHECKED_STATUS',checkbox:true">Ck</th> </tr> </thead> </table>
|
|
|
2243
|
General Category / EasyUI for jQuery / Re: Combobox autocomplete whilst limiting options to those listed
|
on: June 02, 2014, 05:11:03 PM
|
A possible solution to solve this issue is to add a validate type to this combobox. When inputed value is invalid, the prompt message will display. $.extend($.fn.validatebox.defaults.rules,{ inList:{ validator:function(value,param){ var c = $(param[0]); var opts = c.combobox('options'); var data = c.combobox('getData'); var exists = false; for(var i=0; i<data.length; i++){ if (value == data[i][opts.textField]){ exists = true; break; } } return exists; }, message:'invalid value.' } })
Apply this 'inList' validation type to a combobox component. $('#cc').combobox({ validType:'inList["#cc"]' });
|
|
|
2246
|
General Category / Bug Report / Re: Menubutton: Incorrect menu position
|
on: May 28, 2014, 02:30:13 PM
|
The height of edit menu is too large to display normally. If it can not display on bottom, it will try to display on the top. If it can not display on top again, it will go back to the bottom. So to solve your issue, the simplest way is to limit the height for the menu. Set a height style for it.
|
|
|
2249
|
General Category / EasyUI for jQuery / Re: prepend a blank option to combobox
|
on: May 28, 2014, 01:13:30 AM
|
You can use 'loadFilter' function to prepend an empty row, please try this code: $('#cc').combobox({ loadFilter:function(data){ var opts = $(this).combobox('options'); var emptyRow = {}; emptyRow[opts.valueField] = ''; emptyRow[opts.textField] = ' '; data.unshift(emptyRow); return data; } })
|
|
|
|